chore(build): allow npm link and inject NODE_ENV
injecting NODE_ENV can reduce the build given libraries
This commit is contained in:
parent
389a4ad110
commit
4dcda4832b
2 changed files with 30 additions and 3 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import {join} from 'path';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
entry: './index.js',
|
entry: './index.js',
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
|
|
@ -12,6 +15,18 @@ export default {
|
||||||
test: /\.js$/, exclude: /node_modules/, loader: 'babel'
|
test: /\.js$/, exclude: /node_modules/, loader: 'babel'
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
externals: [],
|
resolve: {
|
||||||
plugins: []
|
fallback: [join(__dirname, '..', 'node_modules')]
|
||||||
|
},
|
||||||
|
// same issue, for loaders like babel
|
||||||
|
resolveLoader: {
|
||||||
|
fallback: [join(__dirname, '..', 'node_modules')]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': {
|
||||||
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import {join} from 'path';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
entry: './dev/app.js',
|
entry: './dev/app.js',
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
|
|
@ -14,5 +16,15 @@ export default {
|
||||||
contentBase: 'dev/',
|
contentBase: 'dev/',
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
compress: true
|
compress: true
|
||||||
}
|
},
|
||||||
|
// when module not found, find locally first
|
||||||
|
// helps fixing the npm link not working with webpack
|
||||||
|
// http://stackoverflow.com/a/33722844/147079
|
||||||
|
resolve: {
|
||||||
|
fallback: [join(__dirname, '..', 'node_modules')]
|
||||||
|
},
|
||||||
|
// same issue, for loaders like babel
|
||||||
|
resolveLoader: {
|
||||||
|
fallback: [join(__dirname, '..', 'node_modules')]
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue