Update TS example

This commit is contained in:
Sebastien Chopin 2017-05-29 17:24:40 +02:00
parent 03f2e133b1
commit d9d5d1a5d8
3 changed files with 8 additions and 27 deletions

View File

@ -1,19 +0,0 @@
//Deleting this file will cause "TS18003: No inputs were found in config file 'tsconfig.json'"
//These declarations allow TypeScript to import non-js/ts files without the file extensions (such as .vue files)
declare module "~components/*" {
}
declare module "~layouts/*" {
}
declare module "~pages/*" {
}
declare module "~assets/*" {
}
declare module "~static/*" {
}

View File

@ -3,16 +3,16 @@ module.exports = function (options, next) {
this.extendBuild((config) => {
// Add TypeScript loader
config.module.rules.push({
test: /\.ts$/,
loader: 'ts-loader'
test: /\.ts$/,
loader: 'ts-loader'
})
// Add TypeScript loader for vue files
for (rule of config.module.rules) {
if (rule.loader === 'vue-loader') {
rule.query.loaders.ts = 'ts-loader?{"appendTsSuffixTo":["\\\\.vue$"]}'
}
if (rule.loader === 'vue-loader') {
rule.query.loaders.ts = 'ts-loader?{"appendTsSuffixTo":["\\\\.vue$"]}'
}
}
})
next()
}
}

View File

@ -4,7 +4,7 @@
"dependencies": {
"axios": "^0.16.1",
"gsap": "^1.19.1",
"nuxt": "latest",
"nuxt": "^1.0.0-alpha2",
"nuxt-class-component": "^1.0.1",
"tachyons": "^4.7.0",
"vue-class-component": "^5.0.1",
@ -21,4 +21,4 @@
"ts-loader": "^2.0.3",
"typescript": "^2.2.2"
}
}
}