transpile with babel

This commit is contained in:
Ray Elliott 2021-01-03 19:55:19 +00:00
parent aaf01c5f21
commit e9c146c91c
4 changed files with 1320 additions and 1 deletions

View File

@ -76,6 +76,10 @@ with
## Notes ## Notes
when specifying the css minimizer in the config, this causes us to no longer be
using the defaults (which includes js minification for production). This means
we have to tell webpack to minimise the js explicitly (or use to also defaults with '...')
Asset management: Asset management:
>= webpack 5.0 - use asset modules (replaces raw-loader, url-loader, file-loader) >= webpack 5.0 - use asset modules (replaces raw-loader, url-loader, file-loader)

1301
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,9 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"babel-loader": "^8.2.2",
"clean-webpack-plugin": "^3.0.0", "clean-webpack-plugin": "^3.0.0",
"css-loader": "^5.0.1", "css-loader": "^5.0.1",
"cssnano-webpack-plugin": "^1.0.3", "cssnano-webpack-plugin": "^1.0.3",

View File

@ -31,6 +31,16 @@ module.exports = env => {
], ],
module: { module: {
rules: [ rules: [
{
test: /\.js?/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
{ {
test: /\.inline\.css$/i, test: /\.inline\.css$/i,
include: path.resolve(__dirname, 'src/css'), include: path.resolve(__dirname, 'src/css'),
@ -77,7 +87,8 @@ module.exports = env => {
minimizer: [ minimizer: [
new CssnanoPlugin({ new CssnanoPlugin({
sourceMap: true, sourceMap: true,
}) }),
'...', // access defaults (defaults are overridden when specifying minimizer: array)
], ],
}, },
} }