1
0
Fork 0

chore(build): allow npm link and inject NODE_ENV

injecting NODE_ENV can reduce the build given libraries
This commit is contained in:
vvo 2015-12-16 12:04:01 +01:00
parent 389a4ad110
commit 4dcda4832b
2 changed files with 30 additions and 3 deletions

View file

@ -1,3 +1,6 @@
import webpack from 'webpack';
import {join} from 'path';
export default {
entry: './index.js',
devtool: 'source-map',
@ -12,6 +15,18 @@ export default {
test: /\.js$/, exclude: /node_modules/, loader: 'babel'
}]
},
externals: [],
plugins: []
resolve: {
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)
}
})
]
};

View file

@ -1,3 +1,5 @@
import {join} from 'path';
export default {
entry: './dev/app.js',
devtool: 'source-map',
@ -14,5 +16,15 @@ export default {
contentBase: 'dev/',
host: '0.0.0.0',
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')]
},
};