Repository navigation
feat(template-vite): switch to esm by default. - #3572
caoxiemeihao wants to merge 2 commits into
Conversation
|
This looks like it's less like "support esm", and more like "switch to esm." Not a bad thing really, but is this another potentially breaking change that's going to land in another minor release? 🤔 |
#3572 is just making some changes to the template, not a major upgrade. If you have any concerns about this, I can consider closing this PR and only providing a document to inform users how to switch to I think when the I am initiating a vote below, hoping that people who default to using the |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
esm by default.
|
I kind of liked your idea of building according to the package.json's I don't know if it's a good idea to separate the ideas of
I'm seeing, for instance, with this PR that the preload script is still being built into commonjs (and two commented links adding some context for that), while the host and renderer are defaulting to "follow the package.json". |
|
@caoxiemeihao in local testing in my single environment, I found that with new BrowserWindow({
webPreferences: {
preload: resolveRelative("./preload.cjs"),
},
})Otherwise node would complain about the importing a module with require (regardless of the content of preload being commonjs or esmodule). Testing with
I'm not finding a path to import an esm-compiled preload script at all... (skill issue?) |
|
I've provided samples for |
|
If you try adding in the above sample preload.js files: import * as e from 'electron';and check the compiled output, they are commonjs (as specified by the They load fine, as they're not esm, and I checked and it doesn't matter if I use a (If you set the format to |
For folks finding this who may be using typescript + tailwind and still having issues, make note of a change to the preload extension when creating BrowserWindows as well as this note about the extension on your postcss config
After going through and updating my files to match |





Summarize your changes:
Closes #3502, #3503