mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +00:00
fix: prioritize nested node_modules in webpack search path (#2558)
This commit is contained in:
parent
118d3fb8c2
commit
811201925d
@ -16,6 +16,9 @@ const WarnFixPlugin = require('./plugins/warnfix')
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
module.exports = function webpackBaseConfig({ name, isServer }) {
|
||||
// Prioritize nested node_modules in webpack search path (#2558)
|
||||
const webpackModulesDir = ['node_modules'].concat(this.options.modulesDir)
|
||||
|
||||
const config = {
|
||||
name,
|
||||
entry: {
|
||||
@ -25,9 +28,9 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
||||
path: resolve(this.options.buildDir, 'dist'),
|
||||
filename: this.getFileName('app'),
|
||||
chunkFilename: this.getFileName('chunk'),
|
||||
publicPath: (isUrl(this.options.build.publicPath)
|
||||
publicPath: isUrl(this.options.build.publicPath)
|
||||
? this.options.build.publicPath
|
||||
: urlJoin(this.options.router.base, this.options.build.publicPath))
|
||||
: urlJoin(this.options.router.base, this.options.build.publicPath)
|
||||
},
|
||||
performance: {
|
||||
maxEntrypointSize: 1000000,
|
||||
@ -43,13 +46,13 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
||||
'@@': join(this.options.rootDir),
|
||||
// Used by vue-loader so we can use in templates
|
||||
// with <img src="~/assets/nuxt.png"/>
|
||||
'assets': join(this.options.srcDir, 'assets'),
|
||||
'static': join(this.options.srcDir, 'static')
|
||||
assets: join(this.options.srcDir, 'assets'),
|
||||
static: join(this.options.srcDir, 'static')
|
||||
},
|
||||
modules: this.options.modulesDir
|
||||
modules: webpackModulesDir
|
||||
},
|
||||
resolveLoader: {
|
||||
modules: this.options.modulesDir
|
||||
modules: webpackModulesDir
|
||||
},
|
||||
module: {
|
||||
noParse: /es6-promise\.js$/, // Avoid webpack shimming process
|
||||
@ -67,9 +70,18 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
||||
},
|
||||
{ test: /\.css$/, use: styleLoader.call(this, 'css') },
|
||||
{ test: /\.less$/, use: styleLoader.call(this, 'less', 'less-loader') },
|
||||
{ test: /\.sass$/, use: styleLoader.call(this, 'sass', {loader: 'sass-loader', options: { indentedSyntax: true }}) },
|
||||
{
|
||||
test: /\.sass$/,
|
||||
use: styleLoader.call(this, 'sass', {
|
||||
loader: 'sass-loader',
|
||||
options: { indentedSyntax: true }
|
||||
})
|
||||
},
|
||||
{ test: /\.scss$/, use: styleLoader.call(this, 'scss', 'sass-loader') },
|
||||
{ test: /\.styl(us)?$/, use: styleLoader.call(this, 'stylus', 'stylus-loader') },
|
||||
{
|
||||
test: /\.styl(us)?$/,
|
||||
use: styleLoader.call(this, 'stylus', 'stylus-loader')
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpe?g|gif|svg)$/,
|
||||
loader: 'url-loader',
|
||||
|
Loading…
Reference in New Issue
Block a user