mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +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
|
||||
this.extendBuild((config) => {
|
||||
this.extendBuild(config => {
|
||||
const tsLoader = {
|
||||
loader: "ts-loader",
|
||||
options: {
|
||||
appendTsSuffixTo: [/\.vue$/]
|
||||
}
|
||||
};
|
||||
// Add TypeScript loader
|
||||
config.module.rules.push({
|
||||
test: /\.ts$/,
|
||||
loader: 'ts-loader'
|
||||
})
|
||||
config.module.rules.push(
|
||||
Object.assign(
|
||||
{
|
||||
test: /((client|server)\.js)|(\.tsx?)$/
|
||||
},
|
||||
tsLoader
|
||||
)
|
||||
);
|
||||
// Add TypeScript loader for vue files
|
||||
for (let rule of config.module.rules) {
|
||||
if (rule.loader === 'vue-loader') {
|
||||
rule.query.loaders.ts = 'ts-loader?{"appendTsSuffixTo":["\\\\.vue$"]}'
|
||||
if (rule.loader === "vue-loader") {
|
||||
rule.options.loaders.ts = tsLoader;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -1,29 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2015"
|
||||
],
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"experimentalDecorators": true,
|
||||
"declaration": true,
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": true,
|
||||
"removeComments": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"~": ["./"],
|
||||
"~assets/*": ["./assets/*"],
|
||||
"~components/*": ["./components/*"],
|
||||
"~middleware/*": ["./middleware/*"],
|
||||
"~pages/*": ["./pages/*"],
|
||||
"~plugins/*": ["./plugins/*"],
|
||||
"~static/*": ["./static/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2015"
|
||||
],
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"experimentalDecorators": true,
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": true,
|
||||
"removeComments": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"baseUrl": ".",
|
||||
"allowJs": true,
|
||||
"paths": {
|
||||
"~/": ["./"],
|
||||
"~/assets/*": ["./assets/*"],
|
||||
"~/components/*": ["./components/*"],
|
||||
"~/middleware/*": ["./middleware/*"],
|
||||
"~/pages/*": ["./pages/*"],
|
||||
"~/plugins/*": ["./plugins/*"],
|
||||
"~/static/*": ["./static/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user