I have 2 files, a.js and b.js:
a.js:
function hello() {
alert('hey');
alert('bye');
}
b.js:
const name = 'Bob';
alert(name)
I import them both in my entry file:
import './a';
import './b';
I want to combine them, my webpack.config.js looks like this:
const path = require('path');
module.exports = {
entry: './entry.js',
mode: 'production',
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
}
};
When I run webpack I get a module:
// etc...
/***/ (function(module, exports) {
function hello() {
alert('hey');
alert('bye');
}
/***/ }),
/* 2 */
/***/ (function(module, exports) {
const name = 'Bob';
alert(name)
/***/ })
/******/ ]);
Instead how can I just get:
function hello() {
alert('hey');
alert('bye');
}
const name = 'Bob';
alert(name)
This plugin does what I want to achieve but there is a bug where I can't minify the combined file, on top of that I would also like to run babel to transform the code to be es5 compatible. All these things seem to be a lot easier to do the regular webpack way so it would be great if I can just get webpack to export a normal script instead of a module..