diff --git a/src/VueProgram.ts b/src/VueProgram.ts
index 80e60567..a34784a9 100644
--- a/src/VueProgram.ts
+++ b/src/VueProgram.ts
@@ -216,7 +216,7 @@ class VueProgram {
if (!script) {
return {
scriptKind: ts.ScriptKind.JS,
- content: '// tslint:disable\nexport default {};\n'
+ content: '/* tslint:disable */\nexport default {};\n'
};
}
@@ -228,8 +228,14 @@ class VueProgram {
const src = script.attrs.src.replace(/\.tsx?$/i, '');
return {
scriptKind,
- content: '// tslint:disable\n'
+
+ // For now, ignore the error when the src file is not found
+ // since it will produce incorrect code location.
+ // It's not a large problem since it's handled on webpack side.
+ content: '/* tslint:disable */\n'
+ + '// @ts-ignore\n'
+ `export { default } from '${src}';\n`
+ + '// @ts-ignore\n'
+ `export * from '${src}';\n`
};
}
diff --git a/test/integration/vue.spec.js b/test/integration/vue.spec.js
index 8413d39c..1d97238e 100644
--- a/test/integration/vue.spec.js
+++ b/test/integration/vue.spec.js
@@ -154,11 +154,13 @@ describe('[INTEGRATION] vue', function () {
});
});
- it('should resolve src attribute and check referred source', function (callback) {
+ it('should resolve src attribute but not report not found error', function (callback) {
createCompiler({ vue: true, tsconfig: 'tsconfig-attrs.json' });
compiler.run(function(error, stats) {
- expect(stats.compilation.errors.length).to.be.equal(1);
+ const errors = stats.compilation.errors;
+ expect(errors.length).to.be.equal(1);
+ expect(errors[0].file).to.match(/test\/integration\/vue\/src\/attrs\/test.ts$/);
callback();
});
});
diff --git a/test/integration/vue/src/attrs/NotFound.vue b/test/integration/vue/src/attrs/NotFound.vue
new file mode 100644
index 00000000..1ad5a262
--- /dev/null
+++ b/test/integration/vue/src/attrs/NotFound.vue
@@ -0,0 +1,5 @@
+
+ Hello
+
+
+
diff --git a/test/integration/vue/tsconfig-attrs.json b/test/integration/vue/tsconfig-attrs.json
index b54d8781..2bdc66c5 100644
--- a/test/integration/vue/tsconfig-attrs.json
+++ b/test/integration/vue/tsconfig-attrs.json
@@ -1,7 +1,8 @@
{
"compilerOptions": {},
"include": [
- "src/attrs/Test.vue"
+ "src/attrs/Test.vue",
+ "src/attrs/NotFound.vue"
],
"exclude": [
"node_modules"