Transpiled webpack bundle does not export hyphenated package name via require
See original GitHub issueStackOverflow question Example Repo Breaking commit
The Main.js
file within the app’s contents, after running npm run package
, includes a line function(e,t){e.exports=fluent-ffmpeg}
. When I try to open the app, I receive this error: Uncaught Exception: ReferenceError: fluent is not defined
I can fix this by manually editing the aforementioned line to read: function(e,t){e.exports=require("fluent-ffmpeg")}
Steps to reproduce
- I cloned this repo
- added the
fluent-ffmpeg
package - add
import ffmpeg from 'fluent-ffmpeg'
intomain.development.js
npm run package
- open app
My Example Repo shows this same error.
Any help with making fluent-ffmpeg
work with this repo would be appreciated.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Transpiled webpack bundle does not export hyphenated ...
I was able to solve the issue by simply setting the output.libraryTarget setting within webpack.config.electron.js file to commonjs2 .
Read more >Transpiled webpack bundle does not export hyphenated ...
I was able to solve the issue by simply setting the output.libraryTarget within webpack.config.electron.js file. output: { path: path.join(__ ...
Read more >How to transpile ES modules with webpack and Node.js
Learn how webpack interacts with and supports ES modules in this deep dive tutorial on transpilation in Node.js.
Read more >[Solved]-Webpack bundle license compliance?-node.js
Note that licenses of dependencies listed in the devDependencies are not included ... Transpiled webpack bundle does not export hyphenated package name via...
Read more >Package exports - webpack
Such a package would only work in Node.js >= 14 and only when using import . It won't work with require() . Providing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was able to solve the issue by simply setting the
output.libraryTarget
withinwebpack.config.electron.js
file.@eugenehp with this boilerplate we could run
npm run package
to deliver the production app. @FraGoTe I was able to maintainexternals
being an array. The only possible change to this boilerplate that is related to this issue might be the settingoutput.libraryTarget
@eugenehp I can see where this can work after running the
npm run dev
command where the server is spun up for development, but after I want to package the application, I would need a separate API running to access ffmpeg. I want to be able to runfluent-ffmpeg
apart of an offline application without spinning up a server.I might have found a fix by changing
externals
inside thewebpack.config.base.js
to read:I have yet to confirm this actually works