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

ykit pack -m打包时总说找不到fs\net\tls模块 #70

Open
yyltesting opened this issue Apr 27, 2022 · 5 comments
Open

ykit pack -m打包时总说找不到fs\net\tls模块 #70

yyltesting opened this issue Apr 27, 2022 · 5 comments

Comments

@yyltesting
Copy link

引入mysql后始终无法打包成功,pagejck.json里面也都引入了mysql,且能正常使用,但是打包总是报错找不到fs模块 请问在哪里配置改呢

@owen-kuai
Copy link

请问后续有解决办法嘛,我目前也遇到了这个问题

[error] .//fs-extra/lib/empty/index.js
Module not found: Error: Cannot resolve module 'fs' in /app/node_modules/fs-extra/lib/empty
@ ./
/fs-extra/lib/empty/index.js 4:11-24

[error] .//nodemailer/lib/mailer/index.js
Module not found: Error: Cannot resolve module 'net' in /app/node_modules/nodemailer/lib/mailer
@ ./
/nodemailer/lib/mailer/index.js 13:12-26

[error] .//nodemailer/lib/mailer/index.js
Module not found: Error: Cannot resolve module 'dns' in /app/node_modules/nodemailer/lib/mailer
@ ./
/nodemailer/lib/mailer/index.js 14:12-26

[error] .//nodemailer/lib/shared/index.js
Module not found: Error: Cannot resolve module 'fs' in /app/node_modules/nodemailer/lib/shared
@ ./
/nodemailer/lib/shared/index.js 5:11-24

[error] .//nodemailer/lib/sendmail-transport/index.js
Module not found: Error: Cannot resolve module 'child_process' in /app/node_modules/nodemailer/lib/sendmail-transport
@ ./
/nodemailer/lib/sendmail-transport/index.js 3:14-38

[error] .//nodemailer/lib/smtp-connection/http-proxy-client.js
Module not found: Error: Cannot resolve module 'net' in /app/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/http-proxy-client.js 7:12-26

[error] .//nodemailer/lib/smtp-connection/index.js
Module not found: Error: Cannot resolve module 'net' in /app/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/index.js 5:12-26

[error] .//nodemailer/lib/smtp-connection/http-proxy-client.js
Module not found: Error: Cannot resolve module 'tls' in /app/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/http-proxy-client.js 8:12-26

[error] .//nodemailer/lib/smtp-connection/index.js
Module not found: Error: Cannot resolve module 'tls' in /app/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/index.js 6:12-26

[error] .//nodemailer/lib/dkim/index.js
Module not found: Error: Cannot resolve module 'fs' in /app/node_modules/nodemailer/lib/dkim
@ ./
/nodemailer/lib/dkim/index.js 10:11-24

[error] .//graceful-fs/graceful-fs.js
Module not found: Error: Cannot resolve module 'fs' in /app/node_modules/graceful-fs
@ ./
/graceful-fs/graceful-fs.js 1:9-22

[error] .//nodemailer/lib/mime-node/index.js
Module not found: Error: Cannot resolve module 'fs' in /app/node_modules/nodemailer/lib/mime-node
@ ./
/nodemailer/lib/mime-node/index.js 7:11-24

[error] .//jsonfile/index.js
Module not found: Error: Cannot resolve module 'fs' in /app/node_modules/jsonfile
@ ./
/jsonfile/index.js 5:8-21

[error] .//graceful-fs/fs.js
Module not found: Error: Cannot resolve module 'fs' in /app/node_modules/graceful-fs
@ ./
/graceful-fs/fs.js 3:9-22

[error] [email protected] from UglifyJs
SyntaxError: Unexpected token: operator (>) [../~/fs-extra/lib/util/assign.js:5,0]

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-client: NODE_ENV=production ykit pack -m
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-client script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@vinson-zhang
Copy link

+1

@yang-leicheng
Copy link

+1,有可以解决的方案吗

@tiger-colonel
Copy link

+1

@zystudios
Copy link

zystudios commented Apr 23, 2024

参考 YMFE/yapi#2727


//如果不想把第三方库打包到bundle中,就用externals解决
baseConfig.externals= { 
  fs: require('fs'),
  net: require('net'),
  dns: require('dns'),
  tls: require('tls'),
  child_process: require('child_process'),
} ;
 

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

6 participants