Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack 完全教程-09-多入口文件编译 #65

Open
GuoYongfeng opened this issue Jul 24, 2016 · 0 comments
Open

webpack 完全教程-09-多入口文件编译 #65

GuoYongfeng opened this issue Jul 24, 2016 · 0 comments

Comments

@GuoYongfeng
Copy link
Member

多入口文件编译

创建两个entry入口文件

$ cd src && mkdir entry1.js entry2.js

entry1.js

document.write('<h1>用友网络FED团队</h1>');

entry2.js

document.write('<h1>webpack完全教程</h1>');

index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Webpack 完全教程</title>
</head>
<body>
  <script src="./dist/entry1.js"></script>
  <script src="./dist/entry2.js"></script>
</body>
</html>

webpack.config.js

const path = require('path');

module.exports = {
  entry: {
    bundle1: './src/entry1.js',
    bundle2: './src/entry2.js'
  },
  output: {
    path: './dist',
    filename: '[name].js'
  }
};

运行

$ npm run dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant