Closed ttraenkler closed 7 years ago
This is not something that electron-compile
should be doing.
You can do this in many ways in a node environment.
There is a module to do it for you: https://www.npmjs.com/package/module-alias
Or you can set it up as part of your babel config in your .compilerc
: https://www.npmjs.com/package/babel-plugin-module-alias
Thanks for the hint!
Hi, I do not want to open extra ticket, but I think, that the proposed solution will not work in case I need to create an alias of npm package A to npm package B for the development environment.
Background: I am trying to get the react-dom - hot-loader edition working, but I am still facing the infamous warning message.
Basically I need to alias "react-dom" to "@hot-loader/react-dom", so I updated my .compilerc as follows:
{
"env": {
"development": {
"application/javascript": {
"presets": [
["env", { "targets": { "electron": "1.6.0" } }],
"react"
],
"plugins": ["transform-async-to-generator", "transform-es2015-classes", "react-hot-loader/babel",
["module-resolver", {
"alias": {
"react-dom": "@hot-loader/react-dom"
}
}]
],
...
Sadly this did not help. Then I found following issue stating:
Hi @siddharthkp, this would be possible (although not without problems) if you applied the transform to the files inside node_modules. Usually node_modules are ignored.
Maybe you could manually add a "react" package to node_modules that would export preact-compat?
Might this be a reason, the alias is not working as expected ? What can I do about this ?
For my project, I need to create an alias called
react-native
that resolves toreact-native-web
. This is usually done in the webpack configuration - how is this possible with electron-compile?Thanks for your efforts put into electron-compile!