Is there a way that when doing export {default} from "./PostsListing.jsx";
with React and Bud in Sage 10, that I do not need to include the .jsx
extension in the export? Or is this more of something with Webpack/ES6 compiling that it doesn’t recognize the extension.
I was able to write something like this, but I feel this is not really that great to integrate, so wondering if there is something else I can do:
app.config(existingConfig => {
const resolve = existingConfig.resolve;
resolve.extensionAlias['.js'].push('.jsx')
resolve.extensions.push('.jsx')
return ({
...existingConfig,
resolve,
})
})
I could be wrong, but doesn’t ESM require providing the extension? There’s so many different extensions at this point I don’t mind being explicit with the full filenames
https://nodejs.org/api/esm.html#esm_mandatory_file_extensions
When I looked at the output for existingConfig.resolve
arrays, the extension for js
was in there, but not jsx
. So I could do import {default} from "./path/to/javascript.js
without the .js
and it would compile fine. If I did that with .jsx
it would not. Same thing with the mj*
extensions.