Skip to content

Commit 580ce0b

Browse files
committed
Fix Vue TypeScript errors
Signed-off-by: Christopher Ng <chrng8@gmail.com>
1 parent 7300017 commit 580ce0b

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

webpack.common.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,16 @@ module.exports = {
8989
},
9090
{
9191
test: /\.tsx?$/,
92-
use: 'babel-loader',
92+
use: [
93+
'babel-loader',
94+
{
95+
// Fix TypeScript syntax errors in Vue
96+
loader: 'ts-loader',
97+
options: {
98+
transpileOnly: true,
99+
},
100+
},
101+
],
93102
exclude: BabelLoaderExcludeNodeModulesExcept([]),
94103
},
95104
{
@@ -210,6 +219,13 @@ module.exports = {
210219
vue$: path.resolve('./node_modules/vue'),
211220
},
212221
extensions: ['*', '.ts', '.js', '.vue'],
222+
extensionAlias: {
223+
/**
224+
* Resolve TypeScript files when using fully-specified esm import paths
225+
* https://github.com/webpack/webpack/issues/13252
226+
*/
227+
'.js': ['.js', '.ts'],
228+
},
213229
symlinks: true,
214230
fallback: {
215231
fs: false,

0 commit comments

Comments
 (0)