Webpack the small case of beginners ' notes Demo1

Source: Internet
Author: User

Next article:

Create a file underneath the Webpack-test1 folder Hello.js

And then hit the code at the command line.

Webpack Hello.js Hello.bundle.js

First enter the name of the file you want to package and then the file name after the package

After the package is successful, you will see a code like this: a hash,webpack version number, and the time it takes to pack.

Next we create a bye.js file, which includes a reference to the Hello.js

Create a simple function in bye

References to Bye.js in Hello.js are referenced in require way

Then execute the code again and there will be two modules

Next we create a CSS file and reference it in Hello.js

However, you need to install two loader before referencing, because the webpack itself is not a CSS file support

Next, refer to in Hello.js

Next, create a demo.html file to show the entire page

We can see the effect on the page!

So you see that the style in the page is referenced by a style tag.

Is that not every time we have to cite this?

No, we can do this at the command line:

Webpack the small case of beginners ' notes Demo1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.