This message was deleted.
# helpdesk
s
This message was deleted.
c
I think adding
mjs
and corresponding module rule in webpack extension config fixed it
👍 1
d
I've seen something like this previously where updating react-scripts have resolved it for me. My JS foo isn't very good so it's unclear what the root cause was.
@polite-kilobyte-67570 is this an expected workaround with mjs? maybe we should add to repo README?
👍 1
đź‘€ 1
c
yeah, I think it’s the webpack config issue as it doesn’t recognize
mjs
extension by default. Need to specify the rule
🙏 1
For me, the following webpack config worked:
Copy code
{
  resolve: {
    extensions: ['mjs'],
  },
  module: {
    rules: [
         {
           test: /\.mjs$/,
           include: /node_modules/,
           type: 'javascript/auto'
         },
    ],
  }
}
🙌 1
p
hi @cool-notebook-80441 this should work out of the box in so far, that your build pipeline shouldn’t be picking up the
.mjs
extension of the package in the first place if it’s not supported. we publish the package both in
umd
and
esm
flavors for that reason. curious to know why that fails for you. Could you share some more info about your web client setup: • which react version are you using? • which webpack version? • nextjs or cra? • which package manager (and version)? • how are you importing the components package?
c
Hi @polite-kilobyte-67570, sorry I am not a web expert. But here are what I found, we use: • “react”: “^16.8.6", • “webpack”: “4.40.2", • It seems like we use neither nextjs nor cra • npm is 6.14.11, but not sure if we use the exact version since we seem to use our own edition of npm • We use similar to npm add command We use Bazel as our building system