Simple learning [1] - JS package

webpack entry <entry> output

webpack --config webpack.conf.js

 

Step1: Create a new file, which has a app.js a sum.js (name casually named just fine)

app.js (incorporated sum.js)

// the file contents sum.js app.js come into the 
// for ES6 Module1 
Import from SUM './sum' 
the console.log ( 'SUM (23, 24) =', SUM (23 is, 24));

sum.js

export default function (a, b) {
    return a + b
}

Step2: Then execute the following sentence

There is a small pit:

Or some other video like this is written, is written like the old wording, if webpack version is relatively high or not write, or will be error

After executing folder inside it will be more of a bundle.js file

 

Guess you like

Origin www.cnblogs.com/chorkiu/p/11406290.html