I’m trying to import an npm module to Observable notebooks. I tried different ways to package the module. I used babel to build main/browser/module packages.
I also try to use webpack with babel-loader to build the npm package. Here’s the link to the current version:
I compare the output code on
unpkg.com. It looks similar to other packages like d3.
None of these versions can be imported to an Observable notebook. I can import them into a React project.
Does anyone know why I can’t import my module?
It seems like you’ve bundle react, and react uses process.env to set production/dev
similiar problem with folks using rollup to bundle react
07:33PM - 31 Jan 16 UTC
08:39PM - 12 Feb 16 UTC
Rollup bundle my file without errors but I have a react error "Uncaught ReferenceError: process is not defined"
There is my...
c⁵ ⋅ question
@radames thanks for the links. I tried a few things. When I bundle react with the library, Observable loads the library without errors. When I don’t bundle react with the library, I get “invalid module” with process.env. I think the common practice is to not bundle react.
email@example.com (with react, no error)
firstname.lastname@example.org (without react, “invalid module” error)
@dnprock I guess you’re right, you could import react separated.
look at this pattern here