Closed Falieson closed 5 years ago
It looks like your Webpack configuration is trying to compile .ts
files found in node_modules
. Do you have the ability to disable that behavior, at least for certain packages?
Shouldn't that be caught by the exclude node_modules
in babel/ts loader
I have the same issue.
I do not have any config about .ts
files
What is your resolve
in your webpack config. This could be because optimism only exposes a main field and you are filtering that out because you are for example only compiling for browser
and module
resolve: {
extensions: ['.js', '.jsx', '.json'],
modules: ['node_modules'],
},
Could this be causing issue?
Here is more info
The issue seems to be with immutable-tuple
module
tuple.mjs:1 Uncaught ReferenceError: module is not defined
at Module.../../../node_modules/optimism/node_modules/immutable-tuple/dist/tuple.mjs (tuple.mjs:1)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Object.../../../node_modules/optimism/lib/index.js (index.js:4)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module.../../../node_modules/apollo-cache-inmemory/lib/inMemoryCache.js (inMemoryCache.js:1)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module.../../../node_modules/apollo-cache-inmemory/lib/index.js (index.js:1)
Could you try adding this to your webpack module rules:
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
I'll get back to this thread tonight
OMG! That helped. I do not know how I overlooked it. Thanks a lot!
Thanks for everyone's additions to this thread. I tried the a-im-c 1.4.2 again and it worked. A different change I made to webpack must resolving the same issue. I'm glad that workarounds/info is being surfaced for others
Closing as issue seems to be resolved.
Actually @danilobuerger - I forgot that the issue was a runtime build error. It wasn't resolved randomly. I added @JoviDeCroock 's snippet
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
and that resolved it!
@danilobuerger I had to do this as well and I'm not 100% sure why. It seems odd that I need to update my webpack config to use something installed in node_modules.
I upgraded a bunch of packages and then got the below error, so rolled back until I got a working app.
I tried the suggestion in this issue to change my webpack.modules, but that didn't fix my issue. https://github.com/apollographql/apollo-client/issues/3984#issuecomment-433117850
Tested Versions apollo-cache-inmemory
Intended outcome: No problems
Actual outcome on 1.4+ Browser/Runtime error
Compiler error on 1.3.0
How to reproduce the issue:
Versions