webpack用法1
新建文件夹,按住shift右击选择在此处打开命令窗口。
npm init
npm install webpack --save-dev
新建hello.js文件,function hello(str){ alert(str); }
webpack hello.js hello.bundle.js
新建world.js文件 function world(){ return { } }
改hello.js为 require("./world.js");
运行
新建style.css body{background:#ccc;}
改hello.js为require("style-loader!css-loader!./style.css");
npm install css-loader style-loader --save-dev
新建index.js文件<script src="hello.bundle.js"></script> hello.js文件加上hello('hello world!');
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。