mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +00:00
fix: adjust ts config to fix startup error
This commit is contained in:
parent
c0a6ed9ea3
commit
05d0b7a3cd
@ -1,16 +1,26 @@
|
|||||||
module.exports = function (options) {
|
module.exports = function(options) {
|
||||||
// Extend build
|
// Extend build
|
||||||
this.extendBuild((config) => {
|
this.extendBuild(config => {
|
||||||
|
const tsLoader = {
|
||||||
|
loader: "ts-loader",
|
||||||
|
options: {
|
||||||
|
appendTsSuffixTo: [/\.vue$/]
|
||||||
|
}
|
||||||
|
};
|
||||||
// Add TypeScript loader
|
// Add TypeScript loader
|
||||||
config.module.rules.push({
|
config.module.rules.push(
|
||||||
test: /\.ts$/,
|
Object.assign(
|
||||||
loader: 'ts-loader'
|
{
|
||||||
})
|
test: /((client|server)\.js)|(\.tsx?)$/
|
||||||
|
},
|
||||||
|
tsLoader
|
||||||
|
)
|
||||||
|
);
|
||||||
// Add TypeScript loader for vue files
|
// Add TypeScript loader for vue files
|
||||||
for (let rule of config.module.rules) {
|
for (let rule of config.module.rules) {
|
||||||
if (rule.loader === 'vue-loader') {
|
if (rule.loader === "vue-loader") {
|
||||||
rule.query.loaders.ts = 'ts-loader?{"appendTsSuffixTo":["\\\\.vue$"]}'
|
rule.options.loaders.ts = tsLoader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
"module": "es2015",
|
"module": "es2015",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"declaration": true,
|
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"noImplicitThis": false,
|
"noImplicitThis": false,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
@ -16,14 +15,15 @@
|
|||||||
"suppressImplicitAnyIndexErrors": true,
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
|
"allowJs": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"~": ["./"],
|
"~/": ["./"],
|
||||||
"~assets/*": ["./assets/*"],
|
"~/assets/*": ["./assets/*"],
|
||||||
"~components/*": ["./components/*"],
|
"~/components/*": ["./components/*"],
|
||||||
"~middleware/*": ["./middleware/*"],
|
"~/middleware/*": ["./middleware/*"],
|
||||||
"~pages/*": ["./pages/*"],
|
"~/pages/*": ["./pages/*"],
|
||||||
"~plugins/*": ["./plugins/*"],
|
"~/plugins/*": ["./plugins/*"],
|
||||||
"~static/*": ["./static/*"]
|
"~/static/*": ["./static/*"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user