mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
feat: modulesDir option
fixes problems with npx and linked libraries #1076
This commit is contained in:
parent
6d5c248f31
commit
92b6936811
@ -55,13 +55,13 @@ export default function webpackBaseConfig ({ isClient, isServer }) {
|
||||
'assets': join(this.options.srcDir, 'assets') // use in template with <img src="~assets/nuxt.png" />
|
||||
},
|
||||
modules: [
|
||||
join(this.options.rootDir, 'node_modules'),
|
||||
this.options.modulesDir,
|
||||
nodeModulesDir
|
||||
]
|
||||
},
|
||||
resolveLoader: {
|
||||
modules: [
|
||||
join(this.options.rootDir, 'node_modules'),
|
||||
this.options.modulesDir,
|
||||
nodeModulesDir
|
||||
]
|
||||
},
|
||||
|
@ -39,7 +39,8 @@ export default function webpackServerConfig () {
|
||||
// https://github.com/liady/webpack-node-externals
|
||||
nodeExternals({
|
||||
// load non-javascript files with extensions, presumably via loaders
|
||||
whitelist: [/\.(?!(?:js|json)$).{1,5}$/i]
|
||||
whitelist: [/\.(?!(?:js|json)$).{1,5}$/i],
|
||||
modulesDir: this.options.modulesDir
|
||||
})
|
||||
],
|
||||
plugins: (config.plugins || []).concat([
|
||||
|
@ -25,8 +25,10 @@ export default function Options (_options) {
|
||||
_.defaultsDeep(options, Options.defaults)
|
||||
|
||||
// Resolve dirs
|
||||
options.rootDir = (typeof options.rootDir === 'string' && options.rootDir ? options.rootDir : process.cwd())
|
||||
options.srcDir = (typeof options.srcDir === 'string' && options.srcDir ? resolve(options.rootDir, options.srcDir) : options.rootDir)
|
||||
const hasValue = v => typeof v === 'string' && v
|
||||
options.rootDir = hasValue(options.rootDir) ? options.rootDir : process.cwd()
|
||||
options.srcDir = hasValue(options.srcDir) ? resolve(options.rootDir, options.srcDir) : options.rootDir
|
||||
options.modulesDir = resolve(options.rootDir, hasValue(options.modulesDir) ? options.modulesDir : 'node_modules')
|
||||
options.buildDir = join(options.rootDir, options.buildDir)
|
||||
|
||||
// If app.html is defined, set the template path to the user template
|
||||
|
Loading…
Reference in New Issue
Block a user