mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +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" />
|
'assets': join(this.options.srcDir, 'assets') // use in template with <img src="~assets/nuxt.png" />
|
||||||
},
|
},
|
||||||
modules: [
|
modules: [
|
||||||
join(this.options.rootDir, 'node_modules'),
|
this.options.modulesDir,
|
||||||
nodeModulesDir
|
nodeModulesDir
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
resolveLoader: {
|
resolveLoader: {
|
||||||
modules: [
|
modules: [
|
||||||
join(this.options.rootDir, 'node_modules'),
|
this.options.modulesDir,
|
||||||
nodeModulesDir
|
nodeModulesDir
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -39,7 +39,8 @@ export default function webpackServerConfig () {
|
|||||||
// https://github.com/liady/webpack-node-externals
|
// https://github.com/liady/webpack-node-externals
|
||||||
nodeExternals({
|
nodeExternals({
|
||||||
// load non-javascript files with extensions, presumably via loaders
|
// 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([
|
plugins: (config.plugins || []).concat([
|
||||||
|
@ -25,8 +25,10 @@ export default function Options (_options) {
|
|||||||
_.defaultsDeep(options, Options.defaults)
|
_.defaultsDeep(options, Options.defaults)
|
||||||
|
|
||||||
// Resolve dirs
|
// Resolve dirs
|
||||||
options.rootDir = (typeof options.rootDir === 'string' && options.rootDir ? options.rootDir : process.cwd())
|
const hasValue = v => typeof v === 'string' && v
|
||||||
options.srcDir = (typeof options.srcDir === 'string' && options.srcDir ? resolve(options.rootDir, options.srcDir) : options.rootDir)
|
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)
|
options.buildDir = join(options.rootDir, options.buildDir)
|
||||||
|
|
||||||
// If app.html is defined, set the template path to the user template
|
// If app.html is defined, set the template path to the user template
|
||||||
|
Loading…
Reference in New Issue
Block a user