Skip to content

Commit 407511c

Browse files
authored
Merge pull request #456 from halfzebra/core-js-warning
fix(config): specify core-js version to avoid printing warnings
2 parents 23d3a6a + b55ca62 commit 407511c

File tree

2 files changed

+114
-108
lines changed

2 files changed

+114
-108
lines changed

config/webpack.config.dev.js

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports = {
4949
// Errors should be considered fatal in development
5050
require.resolve('react-error-overlay'),
5151

52-
paths.appIndexJs
52+
paths.appIndexJs,
5353
],
5454
output: {
5555
// Add /* filename */ comments to generated require()s in the output.
@@ -63,24 +63,24 @@ module.exports = {
6363
// This is the URL that app is served from. We use "/" in development.
6464
publicPath: publicPath,
6565
// Point sourcemap entries to original disk location (format as URL on Windows)
66-
devtoolModuleFilenameTemplate: info =>
67-
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')
66+
devtoolModuleFilenameTemplate: (info) =>
67+
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'),
6868
},
6969
optimization: {
7070
// Automatically split vendor and commons
7171
// https://twitter.com/wSokra/status/969633336732905474
7272
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
7373
splitChunks: {
7474
chunks: 'all',
75-
name: 'vendors'
75+
name: 'vendors',
7676
},
7777
// Keep the runtime chunk seperated to enable long term caching
7878
// https://twitter.com/wSokra/status/969679223278505985
79-
runtimeChunk: true
79+
runtimeChunk: true,
8080
},
8181
resolve: {
8282
modules: ['node_modules'],
83-
extensions: ['.js', '.elm']
83+
extensions: ['.js', '.elm'],
8484
},
8585
module: {
8686
strictExportPresence: true,
@@ -104,22 +104,24 @@ module.exports = {
104104
// This is probably a fine default to help trim down bundles when
105105
// end-users inevitably import '@babel/polyfill'.
106106
useBuiltIns: 'entry',
107+
// Set the corejs version we are using to avoid warnings in console
108+
corejs: 3,
107109
// Do not transform modules to CJS
108-
modules: false
109-
}
110-
]
110+
modules: false,
111+
},
112+
],
111113
],
112114
plugins: [
113115
// Polyfills the runtime needed for async/await and generators
114116
[
115117
require('@babel/plugin-transform-runtime').default,
116118
{
117119
helpers: false,
118-
regenerator: true
119-
}
120-
]
121-
]
122-
}
120+
regenerator: true,
121+
},
122+
],
123+
],
124+
},
123125
},
124126
// Process any JS outside of the app with Babel.
125127
// Unlike the application JS, we only compile the standard ES features.
@@ -137,23 +139,23 @@ module.exports = {
137139
require('@babel/preset-env').default,
138140
{
139141
// Do not transform modules to CJS
140-
modules: false
141-
}
142-
]
142+
modules: false,
143+
},
144+
],
143145
],
144146
cacheDirectory: true,
145-
highlightCode: true
146-
}
147-
}
148-
]
147+
highlightCode: true,
148+
},
149+
},
150+
],
149151
},
150152
{
151153
test: /\.elm$/,
152154
include: paths.appSrc,
153155
exclude: [/[/\\\\]elm-stuff[/\\\\]/, /[/\\\\]node_modules[/\\\\]/],
154156
use: [
155157
{
156-
loader: require.resolve('elm-hot-webpack-loader')
158+
loader: require.resolve('elm-hot-webpack-loader'),
157159
},
158160
// string-replace-loader works as InterpolateHtmlPlugin for Elm,
159161
// it replaces all of the %PUBLIC_URL% with the URL of your
@@ -164,11 +166,11 @@ module.exports = {
164166
query: {
165167
search: '%PUBLIC_URL%',
166168
replace: publicUrl,
167-
flags: 'g'
168-
}
169+
flags: 'g',
170+
},
169171
},
170172
{
171-
loader: require.resolve('elm-asset-webpack-loader')
173+
loader: require.resolve('elm-asset-webpack-loader'),
172174
},
173175
{
174176
loader: require.resolve('elm-webpack-loader'),
@@ -178,10 +180,10 @@ module.exports = {
178180
// for invalid values, "true" and as a default, enable it
179181
debug: process.env.ELM_DEBUGGER === 'false' ? false : true,
180182
pathToElm: paths.elm,
181-
forceWatch: true
182-
}
183-
}
184-
]
183+
forceWatch: true,
184+
},
185+
},
186+
],
185187
},
186188

187189
// "postcss" loader applies autoprefixer to our CSS.
@@ -197,8 +199,8 @@ module.exports = {
197199
{
198200
loader: require.resolve('css-loader'),
199201
options: {
200-
importLoaders: 1
201-
}
202+
importLoaders: 1,
203+
},
202204
},
203205
{
204206
// Options for PostCSS as we reference these options twice
@@ -212,12 +214,12 @@ module.exports = {
212214
plugins: () => [
213215
require('postcss-flexbugs-fixes'),
214216
autoprefixer({
215-
flexbox: 'no-2009'
216-
})
217-
]
218-
}
219-
}
220-
]
217+
flexbox: 'no-2009',
218+
}),
219+
],
220+
},
221+
},
222+
],
221223
},
222224

223225
{
@@ -229,30 +231,30 @@ module.exports = {
229231
/\.scss$/,
230232
/\.sass$/,
231233
/\.json$/,
232-
/\.svg$/
234+
/\.svg$/,
233235
],
234236
loader: require.resolve('url-loader'),
235237
options: {
236238
limit: 10000,
237-
name: 'static/media/[name].[hash:8].[ext]'
238-
}
239+
name: 'static/media/[name].[hash:8].[ext]',
240+
},
239241
},
240242

241243
// "file" loader for svg
242244
{
243245
test: /\.svg$/,
244246
loader: require.resolve('file-loader'),
245247
options: {
246-
name: 'static/media/[name].[hash:8].[ext]'
247-
}
248-
}
249-
]
248+
name: 'static/media/[name].[hash:8].[ext]',
249+
},
250+
},
251+
],
250252
},
251253
plugins: [
252254
// Generates an `index.html` file with the <script> injected.
253255
new HtmlWebpackPlugin({
254256
inject: true,
255-
template: paths.appHtml
257+
template: paths.appHtml,
256258
}),
257259
// Makes some environment variables available in index.html.
258260
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
@@ -267,7 +269,7 @@ module.exports = {
267269
// Watcher doesn't work well if you mistype casing in a path so we use
268270
// a plugin that prints an error when you attempt to do this.
269271
// See https://github.com/facebook/create-react-app/issues/240
270-
new CaseSensitivePathsPlugin()
272+
new CaseSensitivePathsPlugin(),
271273
],
272274

273275
// Some libraries import Node modules but don't use them in the browser.
@@ -277,9 +279,9 @@ module.exports = {
277279
fs: 'empty',
278280
net: 'empty',
279281
tls: 'empty',
280-
child_process: 'empty'
282+
child_process: 'empty',
281283
},
282284
// Turn off performance processing because we utilize
283285
// our own hints via the FileSizeReporter
284-
performance: false
286+
performance: false,
285287
};

0 commit comments

Comments
 (0)