#.

35 messages ยท Page 1 of 1 (latest)

reef crane
#

Haven't used webpack in a while ๐Ÿ˜

tough orchid
#

bundlers are absolutely not my area

reef crane
#

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

tough orchid
#

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

reef crane
#

It's been a while since I used this stack so I'm rusty too

tough orchid
#

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?

reef crane
#

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?

tough orchid
#

yeah

reef crane
#

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

tough orchid
#

.

sand rover
#

@tough orchid I'm guessing you deleting the original post means it's resolved? (Not sure why remove the original question - makes this less useful if someone else hits the same issue)

#

!resolved