Skip to content

Commit

Permalink
Merge pull request #456 from halfzebra/core-js-warning
Browse files Browse the repository at this point in the history
fix(config): specify core-js version to avoid printing warnings
  • Loading branch information
halfzebra authored May 11, 2020
2 parents 23d3a6a + b55ca62 commit 407511c
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 108 deletions.
98 changes: 50 additions & 48 deletions config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = {
// Errors should be considered fatal in development
require.resolve('react-error-overlay'),

paths.appIndexJs
paths.appIndexJs,
],
output: {
// Add /* filename */ comments to generated require()s in the output.
Expand All @@ -63,24 +63,24 @@ module.exports = {
// This is the URL that app is served from. We use "/" in development.
publicPath: publicPath,
// Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: info =>
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')
devtoolModuleFilenameTemplate: (info) =>
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'),
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
splitChunks: {
chunks: 'all',
name: 'vendors'
name: 'vendors',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true
runtimeChunk: true,
},
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.elm']
extensions: ['.js', '.elm'],
},
module: {
strictExportPresence: true,
Expand All @@ -104,22 +104,24 @@ module.exports = {
// This is probably a fine default to help trim down bundles when
// end-users inevitably import '@babel/polyfill'.
useBuiltIns: 'entry',
// Set the corejs version we are using to avoid warnings in console
corejs: 3,
// Do not transform modules to CJS
modules: false
}
]
modules: false,
},
],
],
plugins: [
// Polyfills the runtime needed for async/await and generators
[
require('@babel/plugin-transform-runtime').default,
{
helpers: false,
regenerator: true
}
]
]
}
regenerator: true,
},
],
],
},
},
// Process any JS outside of the app with Babel.
// Unlike the application JS, we only compile the standard ES features.
Expand All @@ -137,23 +139,23 @@ module.exports = {
require('@babel/preset-env').default,
{
// Do not transform modules to CJS
modules: false
}
]
modules: false,
},
],
],
cacheDirectory: true,
highlightCode: true
}
}
]
highlightCode: true,
},
},
],
},
{
test: /\.elm$/,
include: paths.appSrc,
exclude: [/[/\\\\]elm-stuff[/\\\\]/, /[/\\\\]node_modules[/\\\\]/],
use: [
{
loader: require.resolve('elm-hot-webpack-loader')
loader: require.resolve('elm-hot-webpack-loader'),
},
// string-replace-loader works as InterpolateHtmlPlugin for Elm,
// it replaces all of the %PUBLIC_URL% with the URL of your
Expand All @@ -164,11 +166,11 @@ module.exports = {
query: {
search: '%PUBLIC_URL%',
replace: publicUrl,
flags: 'g'
}
flags: 'g',
},
},
{
loader: require.resolve('elm-asset-webpack-loader')
loader: require.resolve('elm-asset-webpack-loader'),
},
{
loader: require.resolve('elm-webpack-loader'),
Expand All @@ -178,10 +180,10 @@ module.exports = {
// for invalid values, "true" and as a default, enable it
debug: process.env.ELM_DEBUGGER === 'false' ? false : true,
pathToElm: paths.elm,
forceWatch: true
}
}
]
forceWatch: true,
},
},
],
},

// "postcss" loader applies autoprefixer to our CSS.
Expand All @@ -197,8 +199,8 @@ module.exports = {
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1
}
importLoaders: 1,
},
},
{
// Options for PostCSS as we reference these options twice
Expand All @@ -212,12 +214,12 @@ module.exports = {
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
flexbox: 'no-2009'
})
]
}
}
]
flexbox: 'no-2009',
}),
],
},
},
],
},

{
Expand All @@ -229,30 +231,30 @@ module.exports = {
/\.scss$/,
/\.sass$/,
/\.json$/,
/\.svg$/
/\.svg$/,
],
loader: require.resolve('url-loader'),
options: {
limit: 10000,
name: 'static/media/[name].[hash:8].[ext]'
}
name: 'static/media/[name].[hash:8].[ext]',
},
},

// "file" loader for svg
{
test: /\.svg$/,
loader: require.resolve('file-loader'),
options: {
name: 'static/media/[name].[hash:8].[ext]'
}
}
]
name: 'static/media/[name].[hash:8].[ext]',
},
},
],
},
plugins: [
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
inject: true,
template: paths.appHtml
template: paths.appHtml,
}),
// Makes some environment variables available in index.html.
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
Expand All @@ -267,7 +269,7 @@ module.exports = {
// Watcher doesn't work well if you mistype casing in a path so we use
// a plugin that prints an error when you attempt to do this.
// See https://github.com/facebook/create-react-app/issues/240
new CaseSensitivePathsPlugin()
new CaseSensitivePathsPlugin(),
],

// Some libraries import Node modules but don't use them in the browser.
Expand All @@ -277,9 +279,9 @@ module.exports = {
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
child_process: 'empty',
},
// Turn off performance processing because we utilize
// our own hints via the FileSizeReporter
performance: false
performance: false,
};
Loading

0 comments on commit 407511c

Please sign in to comment.