#.
35 messages ยท Page 1 of 1 (latest)
bundlers are absolutely not my area
So first of all, this has nothing to do with tsconfig: I think nothing in this toolchain reads tsconfig
It's probably a Webpack+Babel setup
What's your framework? Does it expose Webpack settings?
Giving me the Webpack version would be helpful too
Here's what you likely want to merge into your Webpack config:
{
test: /\.(js|jsx)$/,
use: {
loader: "babel-loader",
}
}
```I'm writing it out of memory
Okay, seems good
Just try adding a loader for all JS files then
I think you should be augmenting your Webpack config, not Babel config
Ah yes
Sorry, never used Next.js
Yeah
module.exports = {
webpack: (config, options) => {
config.module.rules.push({
test: /\.jsx?/,
use: [
options.defaultLoaders.babel,
],
})
return config
},
}
```Maybe
That means to compile all js/jsx using Babel before bundling it
And Babel is hopefully going to emit commonjs
At least, it's probably going to make node_modules look the same as your own code in Webpack's eyes
i have stuff to do, but i'll give this a go later and let you know if it works or not
i appreciate you filling in the blanks for me, this is really not my area of expertise
thanks @reef crane get some of those points
It's been a while since I used this stack so I'm rusty too
it'll be really nice if this ends up working ๐
will this potentially have a knock-on effect for TS types no longer being any?
No
You are changing the JS compiling settings, not TS type-checking
But why are they any anyway, if you have any idea?
Is the .mjs in your own project?
yeah
In this case, just annotating types with JSDoc should help
You can also consider using .mts and compiling it when .mjs is needed
Yea
Does TS resolve the file?
You can tell by Ctrl clicking the path
.