added sourcemap option for webpack

This commit is contained in:
RemixDev 2022-03-05 11:40:50 +01:00
parent 504b7e06b5
commit a0746f088f

View File

@ -4,10 +4,15 @@ const NodemonPlugin = require('nodemon-webpack-plugin')
module.exports = env => { module.exports = env => {
const isProduction = !!env.production const isProduction = !!env.production
const generateSourceMap = !!env.sourcemap
let devtool = null
if (!isProduction) {
devtool = generateSourceMap ? 'source-map' : 'eval'
}
const config = { const config = {
mode: isProduction ? 'production' : 'development', mode: isProduction ? 'production' : 'development',
entry: './src/index.ts', entry: './src/index.ts',
devtool: isProduction ? false : 'eval', devtool,
module: { module: {
rules: [ rules: [
{ {