paths more DRY

This commit is contained in:
Michael Bradley, Jr 2018-08-17 17:55:59 -05:00
parent f1edc28f6d
commit 421927d815
1 changed files with 6 additions and 3 deletions

View File

@ -28,8 +28,11 @@ const embarkPath = process.env.EMBARK_PATH;
const embarkAliases = require(path.join(dappPath, '.embark/embark-aliases.json')); const embarkAliases = require(path.join(dappPath, '.embark/embark-aliases.json'));
const embarkAssets = require(path.join(dappPath, '.embark/embark-assets.json')); const embarkAssets = require(path.join(dappPath, '.embark/embark-assets.json'));
const embarkNodeModules = path.join(embarkPath, 'node_modules');
const embarkJson = require(path.join(dappPath, 'embark.json')); const embarkJson = require(path.join(dappPath, 'embark.json'));
const buildDir = path.join(dappPath, embarkJson.buildDir);
// it's important to `embark reset` if a pkg version is specified in // it's important to `embark reset` if a pkg version is specified in
// embark.json and changed/removed later, otherwise pkg resolution may behave // embark.json and changed/removed later, otherwise pkg resolution may behave
// unexpectedly, e.g. a different version may get used owing to lexographical // unexpectedly, e.g. a different version may get used owing to lexographical
@ -119,7 +122,7 @@ const base = {
// see: https://github.com/webpack/webpack/issues/6522#issuecomment-371120689 // see: https://github.com/webpack/webpack/issues/6522#issuecomment-371120689
globalObject: 'typeof self !== \'undefined\' ? self : this', globalObject: 'typeof self !== \'undefined\' ? self : this',
libraryTarget: 'umd', libraryTarget: 'umd',
path: path.join(dappPath, embarkJson.buildDir) path: buildDir
}, },
plugins: [new HardSourceWebpackPlugin()], plugins: [new HardSourceWebpackPlugin()],
// profiling and generating verbose stats increases build time; if stats // profiling and generating verbose stats increases build time; if stats
@ -133,13 +136,13 @@ const base = {
modules: [ modules: [
...versions, ...versions,
'node_modules', 'node_modules',
path.join(embarkPath, 'node_modules') embarkNodeModules
] ]
}, },
resolveLoader: { resolveLoader: {
modules: [ modules: [
'node_modules', 'node_modules',
path.join(embarkPath, 'node_modules') embarkNodeModules
] ]
} }
}; };