always add nuxt to modulesDir

This commit is contained in:
Pooya Parsa 2017-12-12 16:27:01 +03:30
parent adb5966ed2
commit a4e2a7cd65
3 changed files with 7 additions and 11 deletions

View File

@ -15,8 +15,6 @@ const WarnFixPlugin = require('./plugins/warnfix')
|--------------------------------------------------------------------------
*/
module.exports = function webpackBaseConfig({ name, isServer }) {
const nodeModulesDir = join(this.options.nuxtDir, 'node_modules')
const config = {
name,
devtool: this.options.dev ? 'cheap-module-eval-source-map' : false,
@ -48,16 +46,10 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
'assets': join(this.options.srcDir, 'assets'),
'static': join(this.options.srcDir, 'static')
},
modules: [
...this.options.modulesDir,
nodeModulesDir
]
modules: this.options.modulesDir
},
resolveLoader: {
modules: [
...this.options.modulesDir,
nodeModulesDir
]
modules: this.options.modulesDir
},
module: {
noParse: /es6-promise\.js$/, // Avoid webpack shimming process

View File

@ -149,7 +149,7 @@ module.exports = function webpackClientConfig() {
if (this.options.build.uglify !== false) {
config.plugins.push(
new UglifyJSPlugin(Object.assign({
cache: true,
// cache: true,
sourceMap: true,
parallel: true,
extractComments: {

View File

@ -59,6 +59,10 @@ Options.from = function (_options) {
}
options.modulesDir = options.modulesDir.filter(dir => hasValue(dir)).map(dir => resolve(options.rootDir, dir))
// Always add nuxt to modulesDir array
const nuxtModulesDir = join(options.nuxtDir, 'node_modules')
options.modulesDir.push(nuxtModulesDir)
// If app.html is defined, set the template path to the user template
options.appTemplatePath = resolve(options.buildDir, 'views/app.template.html')
if (existsSync(join(options.srcDir, 'app.html'))) {