修改了webpack的devtool配置
This commit is contained in:
parent
da346e54cd
commit
948b7b1926
|
|
@ -46,8 +46,9 @@ module.exports = function (webpackEnv) {
|
|||
const isEnvStaging = webpackEnv === 'staging';
|
||||
const isEnvDevelopment = webpackEnv === 'development';
|
||||
const isEnvProduction = webpackEnv === 'production';
|
||||
// 生产环境跟staging环境 shouldUseSourceMap为true 编译带上SourceMap
|
||||
const sourceMap = !isEnvDevelopment ? shouldUseSourceMap : isEnvDevelopment;
|
||||
// 生产环境和staging 默认none,但命令加上--sourcemap时 使用source-map
|
||||
// 开发环境 使用eval-source-map
|
||||
const sourceMap = isEnvDevelopment ? 'inline-source-map' : shouldUseSourceMap ? 'source-map' : false;
|
||||
|
||||
const oakFileLoader = (ext = '[ext]') => {
|
||||
return {
|
||||
|
|
@ -91,11 +92,7 @@ module.exports = function (webpackEnv) {
|
|||
mode: isEnvStaging ? 'none' : (isEnvProduction ? 'production' : 'development'),
|
||||
// Stop compilation early in production
|
||||
bail: !isEnvDevelopment,
|
||||
// 生产环境和staging 默认false,但命令加上--sourcemap时 使用source-map
|
||||
// 开发环境 使用cheap-module-source-map
|
||||
devtool: !isEnvDevelopment
|
||||
? (shouldUseSourceMap ? 'source-map' : false)
|
||||
: 'cheap-module-source-map',
|
||||
devtool: sourceMap,
|
||||
entry: {
|
||||
app: paths.appIndexJs,
|
||||
},
|
||||
|
|
@ -129,7 +126,7 @@ module.exports = function (webpackEnv) {
|
|||
const defaultFb = {
|
||||
crypto: require.resolve('crypto-browserify'),
|
||||
buffer: require.resolve('safe-buffer'),
|
||||
stream: require.resolve('stream-browserify'),
|
||||
stream: false,
|
||||
zlib: require.resolve('browserify-zlib'),
|
||||
events: require.resolve('events/'),
|
||||
querystring: require.resolve('querystring-es3'),
|
||||
|
|
|
|||
|
|
@ -231,9 +231,8 @@ module.exports = function (webpackEnv) {
|
|||
bail: !isEnvDevelopment,
|
||||
// 生产环境和staging 默认false,但命令加上--sourcemap时 使用source-map
|
||||
// 开发环境 使用cheap-module-source-map
|
||||
devtool: !isEnvDevelopment
|
||||
? (shouldUseSourceMap ? 'source-map' : false)
|
||||
: 'cheap-module-source-map',
|
||||
devtool: isEnvDevelopment ? 'eval-source-map':
|
||||
(shouldUseSourceMap ? 'source-map' : 'none'),
|
||||
// These are the "entry points" to our application.
|
||||
// This means they will be the "root" imports that are included in JS bundle.
|
||||
entry: paths.appIndexJs,
|
||||
|
|
|
|||
Loading…
Reference in New Issue