Skip to content

Commit 0cd9537

Browse files
improves sourcemaps (codesandbox#3621)
1 parent fa16af3 commit 0cd9537

File tree

2 files changed

+32
-26
lines changed

2 files changed

+32
-26
lines changed

packages/app/config/webpack.common.js

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -163,31 +163,6 @@ module.exports = {
163163

164164
module: {
165165
rules: [
166-
{
167-
test: /\.(graphql|gql)$/,
168-
exclude: /node_modules/,
169-
loader: `graphql-tag/loader`,
170-
},
171-
{
172-
test: /\.wasm$/,
173-
loader: 'file-loader',
174-
type: 'javascript/auto',
175-
},
176-
{
177-
test: /\.scss$/,
178-
use: getStyleLoaders(
179-
{
180-
importLoaders: 2,
181-
sourceMap: true,
182-
},
183-
'sass-loader'
184-
),
185-
// Don't consider CSS imports dead code even if the
186-
// containing package claims to have no side effects.
187-
// Remove this when webpack adds a warning or an error for this.
188-
// See https://github.com/webpack/webpack/issues/6571
189-
sideEffects: true,
190-
},
191166
// Transpile node dependencies, node deps are often not transpiled for IE11
192167
{
193168
test: [
@@ -209,6 +184,8 @@ module.exports = {
209184
],
210185
loader: 'babel-loader',
211186
query: {
187+
retainLines: true,
188+
cacheDirectory: true,
212189
presets: [
213190
'@babel/preset-flow',
214191
[
@@ -234,6 +211,31 @@ module.exports = {
234211
],
235212
},
236213
},
214+
{
215+
test: /\.(graphql|gql)$/,
216+
exclude: /node_modules/,
217+
loader: `graphql-tag/loader`,
218+
},
219+
{
220+
test: /\.wasm$/,
221+
loader: 'file-loader',
222+
type: 'javascript/auto',
223+
},
224+
{
225+
test: /\.scss$/,
226+
use: getStyleLoaders(
227+
{
228+
importLoaders: 2,
229+
sourceMap: true,
230+
},
231+
'sass-loader'
232+
),
233+
// Don't consider CSS imports dead code even if the
234+
// containing package claims to have no side effects.
235+
// Remove this when webpack adds a warning or an error for this.
236+
// See https://github.com/webpack/webpack/issues/6571
237+
sideEffects: true,
238+
},
237239
{
238240
test: /\.(j|t)sx?$/,
239241
include: [paths.src, /@emmetio/],

packages/app/config/webpack.dev.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const webpack = require('webpack');
12
const merge = require('webpack-merge');
23
// const webpack = require('webpack');
34
const WebpackBar = require('webpackbar');
@@ -19,7 +20,7 @@ module.exports = merge(
1920
},
2021
commonConfig,
2122
{
22-
devtool: 'eval',
23+
devtool: false,
2324
mode: 'development',
2425
output: {
2526
filename: 'static/js/[name].js',
@@ -32,6 +33,9 @@ module.exports = merge(
3233
},
3334
plugins: [
3435
new WebpackBar(),
36+
new webpack.EvalSourceMapDevToolPlugin({
37+
include: /src\/app/,
38+
}),
3539
// new webpack.HotModuleReplacementPlugin(),
3640
],
3741
}

0 commit comments

Comments
 (0)