xz64 / license-webpack-plugin

Outputs licenses from 3rd party libraries to a file
ISC License
165 stars 51 forks source link

Error: ENOENT: no such file or directory, open '/package.json' #93

Closed davidlday closed 3 years ago

davidlday commented 3 years ago

I'm upgrading from v2.3.1 to v2.3.9 via dependabot, and I'm receiving the error in the title. You can view the whole run via GitHub Actions here: https://github.com/davidlday/vscode-languagetool-linter/pull/233/checks?check_run_id=1651482933

In local testing, the problem starts with v2.3.8. v2.3.7 and prior run just fine. I'm using webpack 5 and I do have perChunkOutput: true in my config. Switch perChunkOutput to false has no effect.

xz64 commented 3 years ago

Thanks for reporting this. I will take a look

xz64 commented 3 years ago

Fixed in v2.3.10

The fix is for the plugin to ignore externals as defined here: https://github.com/davidlday/vscode-languagetool-linter/blob/bd62dbbaadf5170a9302f91ca21571410d3821df/webpack.config.ts#L16

jquense commented 3 years ago

@xz64 we're hitting the same error but in a different context with the latest webpack 5. I can't really narrow down why this is happening, but at some point the plugin is trying to process the app itself as a module. PluginChunkReadHandler is trying to read a package.json for the a module who's directory is '', leading to fs.readFileAsUtf8('/package.json') which fails.

My best guess is that this is related to our webpack config depending on the output of another webpack config. eg. we build a bundle and then build the app with the output of that bundle

xz64 commented 3 years ago

@jquense Someone else also reported same issue, please check issue #95 I will work on a fix.