mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
Support ts
This commit is contained in:
parent
48f617d174
commit
4cd48f3927
@ -11,8 +11,9 @@ const filenames = files.keys()
|
|||||||
let storeData = {}
|
let storeData = {}
|
||||||
|
|
||||||
// Check if store/index.js exists
|
// Check if store/index.js exists
|
||||||
if (filenames.indexOf('./index.js') !== -1) {
|
const indexFilename = filenames.find((filename) => filename.includes('./index.'))
|
||||||
storeData = getModule('./index.js')
|
if (indexFilename) {
|
||||||
|
storeData = getModule(indexFilename)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store modules
|
// Store modules
|
||||||
@ -44,14 +45,10 @@ function getModule (filename) {
|
|||||||
const file = files(filename)
|
const file = files(filename)
|
||||||
const module = file.default || file
|
const module = file.default || file
|
||||||
if (module.state && typeof module.state !== 'function') {
|
if (module.state && typeof module.state !== 'function') {
|
||||||
// eslint-disable-next-line no-console
|
throw new Error('[nuxt] store state should be a function.')
|
||||||
console.error('[nuxt] store state should be a function.')
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if (module.commit) {
|
if (module.commit) {
|
||||||
// eslint-disable-next-line no-console
|
throw new Error('[nuxt] store should export raw store options instead of an instance.')
|
||||||
console.error('[nuxt] store should export raw store options instead of an instance.')
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ export default function ({ isClient, isServer }) {
|
|||||||
hints: (this.dev ? false : 'warning')
|
hints: (this.dev ? false : 'warning')
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.json', '.vue'],
|
extensions: ['.js', '.json', '.vue', '.ts'],
|
||||||
// Disable for now
|
// Disable for now
|
||||||
alias: {
|
alias: {
|
||||||
'~': join(this.srcDir),
|
'~': join(this.srcDir),
|
||||||
@ -46,14 +46,14 @@ export default function ({ isClient, isServer }) {
|
|||||||
'~components': join(this.srcDir, 'components')
|
'~components': join(this.srcDir, 'components')
|
||||||
},
|
},
|
||||||
modules: [
|
modules: [
|
||||||
nodeModulesDir,
|
join(this.dir, 'node_modules'),
|
||||||
join(this.dir, 'node_modules')
|
nodeModulesDir
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
resolveLoader: {
|
resolveLoader: {
|
||||||
modules: [
|
modules: [
|
||||||
nodeModulesDir,
|
join(this.dir, 'node_modules'),
|
||||||
join(this.dir, 'node_modules')
|
nodeModulesDir
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
@ -75,8 +75,8 @@ export default function ({ isClient, isServer }) {
|
|||||||
},
|
},
|
||||||
{ test: /\.css$/, use: styleLoader.call(this, 'css') },
|
{ test: /\.css$/, use: styleLoader.call(this, 'css') },
|
||||||
{ test: /\.less$/, use: styleLoader.call(this, 'less', 'less-loader') },
|
{ test: /\.less$/, use: styleLoader.call(this, 'less', 'less-loader') },
|
||||||
{ test: /\.sass$/, use: styleLoader.call(this, 'sass', 'sass-loader?indentedSyntax') },
|
{ test: /\.sass$/, use: styleLoader.call(this, 'sass', 'sass-loader?indentedSyntax&sourceMap') },
|
||||||
{ test: /\.scss$/, use: styleLoader.call(this, 'sass', 'sass-loader') },
|
{ test: /\.scss$/, use: styleLoader.call(this, 'sass', 'sass-loader?sourceMap') },
|
||||||
{ test: /\.styl(us)?$/, use: styleLoader.call(this, 'stylus', 'stylus-loader') }
|
{ test: /\.styl(us)?$/, use: styleLoader.call(this, 'stylus', 'stylus-loader') }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user