mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 17:37:14 +00:00
Support for .coffee files for store and middlewares
This commit is contained in:
parent
f654c9c94c
commit
2816c5687d
@ -1,5 +1,5 @@
|
||||
<% if (middleware) { %>
|
||||
let files = require.context('@/middleware', false, /^\.\/.*\.(js|ts)$/)
|
||||
let files = require.context('@/middleware', false, /^\.\/.*\.(js|ts|coffee)$/)
|
||||
let filenames = files.keys()
|
||||
|
||||
function getModule (filename) {
|
||||
@ -12,7 +12,7 @@ let middleware = {}
|
||||
|
||||
// Generate the middleware
|
||||
for (let filename of filenames) {
|
||||
let name = filename.replace(/^\.\//, '').replace(/\.(js|ts)$/, '')
|
||||
let name = filename.replace(/^\.\//, '').replace(/\.(js|ts|coffee)$/, '')
|
||||
middleware[name] = getModule(filename)
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import Vuex from 'vuex'
|
||||
Vue.use(Vuex)
|
||||
|
||||
// Recursive find files in {srcDir}/store
|
||||
const files = require.context('@/store', true, /^\.\/.*\.(js|ts)$/)
|
||||
const files = require.context('@/store', true, /^\.\/.*\.(js|ts|coffee)$/)
|
||||
const filenames = files.keys()
|
||||
|
||||
// Store
|
||||
@ -30,7 +30,7 @@ if (typeof storeData !== 'function') {
|
||||
}
|
||||
|
||||
for (let filename of filenames) {
|
||||
let name = filename.replace(/^\.\//, '').replace(/\.(js|ts)$/, '')
|
||||
let name = filename.replace(/^\.\//, '').replace(/\.(js|ts|coffee)$/, '')
|
||||
if (name === 'index') continue
|
||||
|
||||
let namePath = name.split(/\//)
|
||||
|
@ -35,7 +35,7 @@ export default function webpackBaseConfig (name) {
|
||||
hints: this.options.dev ? false : 'warning'
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.json', '.vue', '.ts'],
|
||||
extensions: ['.js', '.json', '.vue', '.ts', '.coffee'],
|
||||
alias: {
|
||||
'~': join(this.options.srcDir),
|
||||
'~~': join(this.options.rootDir),
|
||||
|
Loading…
Reference in New Issue
Block a user