Closed dmr closed 7 years ago
The mitt import is missing in lib/rsf.es.js
which is picked by webpack because of "module": "lib/rsf.es.js"
in package.json
.
If you set module to lib/rsf.js, you will have another error mitt is not a constructor
as mitt also specify module in its package.json
.
I think a rebuild should do the trick.
Having the same problem. I ran yarn build
but that didn't resolve the issue.
@hannahjin You have to run the prepublish script instead.
Even with the import statement you will have the following error mitt is not a constructor
.
The problem is that if you use the ES module rsf.es.js
it will import the mitt ES module mitt.es.js
(webpack will do that by default). So in Provider
, it should be import mitt from 'mitt'
instead of import * as mitt from 'mitt'
.
But if you use rsf.js
it will import mitt.js
and then it should be import * as mitt from 'mitt'
.
As a workaround, you can add the following to your webpack conf to force the usage of the umd build :
resolve : {
mainFields : ['umd:main', 'module', 'main'],
},
So you say that my webpack config is the problem?
Is this a mitt issue or a react-slot-fill issue?
Sorry but I don't really understand the issue yet
The missing import is a react-slot-fill build issue.
The fact that it still doesn't work with the import is a mitt issue.
You can use the above workaround to make it work with webpack until this issue is fixed.
The prepublish script is not part of the package. mitt
does appear in my yarn.lock
, but I see that exact error in the picture.
After updating to 1.0.2 I receive import errors "ReferenceError: mitt is not defined"
Does this has to do with this commit? https://github.com/camwest/react-slot-fill/commit/f4087870aa3f74b86cb55f882e9f398586800256