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打包后上传 #50

Open
xlzy520 opened this issue May 19, 2021 · 3 comments
Open

能否支持webpack打包后上传 #50

xlzy520 opened this issue May 19, 2021 · 3 comments

Comments

@xlzy520
Copy link

xlzy520 commented May 19, 2021

node_modules文件太大了,我打包之后,只有很小,本地直接执行这个文件,能正常运行,但是一部署就超时

@xlzy520
Copy link
Author

xlzy520 commented May 19, 2021

问题已解决,这样配置,打包出来的就非常小了,并且可以运行
webpack配置如下:

const path = require('path');

module.exports = {
  entry: './app.js', // 单入口
  mode: "production",
  output: {
    filename: 'pro.js',
    path: path.resolve(__dirname,'dist'),
    libraryTarget: 'commonjs2',
  },
  target: 'node' // 这是最关键的
};

@xlzy520
Copy link
Author

xlzy520 commented May 19, 2021

@xlzy520
Copy link
Author

xlzy520 commented May 19, 2021

70M变成1.3M

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