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

chartjs-node-canvas using webpack #104

Open
yo34 opened this issue May 16, 2022 · 1 comment
Open

chartjs-node-canvas using webpack #104

yo34 opened this issue May 16, 2022 · 1 comment

Comments

@yo34
Copy link

yo34 commented May 16, 2022

Hi,

I using this conf where running webpack :


export default {
  entry: './server.js',
  mode: "production",
  devtool: 'source-map',
  //externals: [nodeExternals({allowlist: [/\.(?!(?:jsx?|json)$).{1,5}$/i],})],
  // la allowlist spécifie les packages qui vont etre dans le bundle
  externals: [nodeExternals({allowlist: [ ...,  'chart.js', 'chartjs-adapter-moment', 'chartjs-node-canvas', 'chartjs-node-canvas']})],

I get the following error where I build the application :


WARNING in ./node_modules/chartjs-node-canvas/dist/freshRequire.js 6:25-46
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/chartjs-node-canvas/dist/index.js 4:23-48
 @ ./graphInit.js 17:0-55 1316:32-49
 @ ./server.js 7:0-38 34:13-41 35:16-42 141:2-28 146:2-29 178:4-39 204:4-39
@SeanSobey
Copy link
Owner

Hi there!

So I have not used webpack much and am not familiar with that error or why there is a need for webpack on Nodejs actually (is it not meant for browser based js?). From my limited understanding, I assume it is complaining about the 'use' of require in that bit of code, since it is a commonjs module thing? I have not yet added support for esm in this lib, and it will be non-trivial given the node-canvas memory management concerns, but it is on the roadmap.

Not sure if this helped? If it is not related to my assumption maybe you can guide me a bit on the details of why/ how it is breaking?

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

2 participants