1

I can't find this anywhere, and Im not sure webpack can actually do it.

I have an old .js file I wanna split into two .js files I want merged together. Not as modules but concatenated.

So hi.js

var yo = 'yo';

and hello.js

console.log(yo, 'hello');

becomes together.js

var yo = 'yo'; console.log(yo, 'hello');

The only way I can see it done now is by refactoring the code to support require or import.

My config:

    entry: {
    'plugin.js': [
        path.join(__dirname, 'keyboards.js'),
        path.join(__dirname, 'functionality.js')
    ]
},
output: {
    path: path.join(__dirname, '/fictional_codespace/'),
    filename: '[name]'
},

This only makes a plugin.js with two eval(), and then they cant see the variables

NicklasN
  • 484
  • 1
  • 7
  • 20

0 Answers0