2016-11-10 02:38:11 +00:00
|
|
|
'use strict'
|
|
|
|
|
2016-11-07 01:34:58 +00:00
|
|
|
const vueLoaderConfig = require('./vue-loader.config')
|
2016-11-09 22:59:41 +00:00
|
|
|
const { join } = require('path')
|
2016-11-07 01:34:58 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Webpack Shared Config
|
|
|
|
|
|
|
|
|
| This is the config which is extented by the server and client
|
|
|
|
| webpack config files
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
*/
|
2016-11-09 22:59:41 +00:00
|
|
|
module.exports = function () {
|
|
|
|
const nodeModulesDir = join(__dirname, '..', '..', '..', 'node_modules')
|
|
|
|
let config = {
|
|
|
|
devtool: 'source-map',
|
|
|
|
entry: {
|
|
|
|
vendor: ['vue', 'vue-router', 'vue-meta', 'es6-promise', 'es6-object-assign']
|
|
|
|
},
|
|
|
|
output: {
|
2016-11-10 16:16:37 +00:00
|
|
|
publicPath: join(this.options.router.base, '/_nuxt/')
|
2016-11-09 22:59:41 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
modules: [
|
|
|
|
nodeModulesDir,
|
|
|
|
join(this.dir, 'node_modules')
|
|
|
|
]
|
|
|
|
},
|
|
|
|
resolveLoader: {
|
|
|
|
modules: [
|
|
|
|
nodeModulesDir,
|
|
|
|
join(this.dir, 'node_modules')
|
|
|
|
]
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
|
|
|
loader: 'vue',
|
|
|
|
options: vueLoaderConfig.call(this)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
options: {
|
|
|
|
presets: ['es2015', 'stage-2']
|
|
|
|
}
|
2016-11-07 01:34:58 +00:00
|
|
|
}
|
2016-11-09 22:59:41 +00:00
|
|
|
]
|
|
|
|
}
|
2016-11-07 01:34:58 +00:00
|
|
|
}
|
2016-11-09 22:59:41 +00:00
|
|
|
// Add nuxt build loaders (can be configured in nuxt.config.js)
|
|
|
|
config.module.rules = config.module.rules.concat(this.options.build.loaders)
|
|
|
|
|
|
|
|
// Return config
|
|
|
|
return config
|
2016-11-07 01:34:58 +00:00
|
|
|
}
|