@zeit/webpack-asset-relocator-loader does not work
See original GitHub issuePreflight Checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project follows, as appropriate.
- I have searched the issue tracker for a bug that matches the one I want to file, without success.
Issue Details
- Electron Forge Version:
- 6.0.0-beta.46
- Electron Version:
- v7.1.3
- Operating System:
- Ubuntu 18.04 x64
- Last Known Working Electron Forge version:
- ?
Expected Behavior
When I install @zeit/webpack-asset-relocator-loader
I expect it it do what it’s supposed to do. Not sure exactly what, but not to break the build for sure.
Actual Behavior
yarn start
writes the following to .webpack/renderer/main_window/index.html
(instead of the real content):
Html Webpack Plugin:
<pre>
Error: /x/src/index.html:82
/******/ __webpack_require__.ab = __dirname + "/native_modules/";
^
ReferenceError: __dirname is not defined
- index.html:82
/x/src/index.html:82:36
- index.html:89
/x/src/index.html:89:10
- index.js:247 HtmlWebpackPlugin.evaluateCompilationResult
[x-app]/[html-webpack-plugin]/index.js:247:28
- index.js:161
[x-app]/[html-webpack-plugin]/index.js:161:23
- task_queues.js:93 processTicksAndRejections
internal/process/task_queues.js:93:5
</pre>
To Reproduce
Take a look at this repo: https://github.com/MOZGIII/electron-webpack-asset-relocator-loader-issue
It has just two commits in the master
branch, first for the yarn create electron-app ... --template=webpack
, and the second to reproduce the bug.
Additional Information
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
zeit/webpack-asset-relocator-loader does not work · Issue #1327
The asset relocator is required as you can't bundle a native module into a JS bundle (it's native compiled code not JS). So...
Read more >@zeit/webpack-asset-relocator-loader - npm
Asset relocation loader used in ncc for performing Node.js builds while emitting and relocating any asset references.
Read more >@zeit/webpack-asset-relocator-loader vulnerabilities | Snyk
Asset relocation loader used in ncc for performing Node.js builds while emitting and relocating any asset references. · latest version.
Read more >@zeit/webpack-asset-relocator-loader: Popularity and Maintenance ...
zeit /webpack-asset-relocator-loader downloads and star history, commits and versions frequency, issues and pull request stats, maintainer info, ...
Read more >@zeit/ncc v0.22.3 Bundlephobia
Size of @zeit/ncc v0.22.3 is 1.2 kB (minified), and 630.0 B when ... This package does not export ES6 modules. ... @zeit/webpack-asset-relocator-loader.
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 FreeTop 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
Top GitHub Comments
Historically most people really don’t care why they need a thing (some do) but most just want to be given the thing, told that it “makes the thing work” and then they move on. 😄
The asset relocator is required as you can’t bundle a native module into a JS bundle (it’s native compiled code not JS). So it scans your dependencies, finds the native modules, and copies them to the appropriate place in the bundled application so that when you ship your app your native modules actually loads.
Yeah I was hopeful that fork wouldn’t live long and upstream would take the change 🤷♂ looks like that didn’t happen 😆
You can see my fork on GH --> https://github.com/MarshallOfSound/webpack-asset-relocator-loader it just has a single additional commit to support electron apps loading native modules where
__dirname
is not a thingThanks a lot for your help and for your work @MarshallOfSound.