bundle your
assets scripts

STATIC ASSETS .png .css .jpg .js MODULES WITH DEPENDENCIES .jpg .png .sass .sass .js .sass .cjs .hbs .js

编写代码

app.js

import bar from './bar';
bar();

bar.js
export default function bar() {
  //
}

使用 webpack 打包

webpack.config.js

module.exports = {
  entry: './app.js',
  output: {
    filename: 'bundle.js'
  }
};

page.html
<!doctype html>
<html>
  <head>
    ...
  </head>
  <body>
    ...
    <script src="bundle.js"></script>
  </body>
</html>

© Copyright. . simonwalkertype.com . All Rights Reserved. Terms | Site Map