A flat configuration helper for webpack
npm i -d flat-webpack-config
mkdir project-name
cd project-name
npm init
npm i -d flat-webpack-config
{
"bundles": {
"app": {
"anticore": "anticore"
},
"polyfills": {
"fetch": "whatwg-fetch",
"Promise": "es6-promise/dist/es6-promise.auto.min.js",
"URL": "js-polyfills/url.js"
}
},
"map": true,
"output": "./assets/js",
"spaces": 2
}
'use strict';
module.exports = require('flat-webpack-config')(__dirname);
// or avoid the `flat-webpack-config.json` file by
module.exports = require('flat-webpack-config')(__dirname, {
"bundles": {
"app": {
"anticore": "anticore"
},
"polyfills": {
"fetch": "whatwg-fetch",
"Promise": "es6-promise/dist/es6-promise.auto.min.js",
"URL": "js-polyfills/url.js"
}
},
"map": true,
"output": "./assets/js",
"spaces": 2
});
webpack
<script defer nomodule src="assets/js/polyfills.min.js"></script>
<script defer src="assets/js/app.min.js"></script>