Comments (6)
Usually the commonjs
module in Rollup should be placed pretty early in the pipeline, like after resolve
, so it may be as simple as that in this case.
from react-fast-compare.
I can confirm, putting the commonjs plugin before the babel plugin solved this. Not certain why that didn't work yesterday during my testing, but glad it's working today... ship it, amiright?
from react-fast-compare.
to answer the original question, our goal is to keep react-fast-compare
small and minimal, and to only provide a commonjs dist.
hopefully for your case we can find the proper configuration for @rollup/plugin-commonjs. To echo @kitten, in their docs they have this note, which explicitly uses @rollup/plugin-commonjs
directly after @rollup/plugin-node-resolve
:
plugins: [resolve(), commonjs()]
(happy to keep discussing in this issue, but i will also close it, as we have no ESM plans)
from react-fast-compare.
Can you provide a small reproduction via a minimal repository for us to install and build? I was under the impression rollup can handle CJS deps with a plugin or something? Thanks!
from react-fast-compare.
Yeah, that was my impression as well. I believe it has to do with the import in a node_module pulling in another node module. It may be that rollup only goes so far `shrug
I ended up rebuilding the entire rollup js file (to ensure all packages were up to date) and ended up with this list of plugins:
const plugins = [
replace({
'process.env.NODE_ENV': JSON.stringify(
process.env.NODE_ENV || 'production'
),
}),
resolve(),
svgr(),
json(),
url(),
postcss({
extract: true,
plugins: [
simplevars(),
nested(),
autoprefixer(),
cssnext({ warnForDuplicates: false }),
],
}),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
}),
peerDepsExternal({
includeDependencies: true,
}),
commonjs({
include: /node_modules/,
}),
autoNamedExports(),
isProduction && terser(),
];
I'll work on a small reproduction, but will not be near my computer to do so (after today) until next Monday, so there may be a slight delay here.
I also added a discussion over in the Popper Spectrum chat to (hopefully) get insight from them: https://spectrum.chat/popper-js/react-popper/getting-error-when-using-rollup-due-to-import-without-default~45c053ae-4442-4502-9f07-8f970aa41649
from react-fast-compare.
Thanks so much for the assistance and answering the question! I'll be diving into this more and hope the suggestions mentioned work!
from react-fast-compare.
Related Issues (20)
- Upgrade dependencies
- Add ability to compare functions HOT 9
- module '/node_modules/react-fast-compare/index.js' does not provide an export HOT 1
- Handle anonymous function HOT 2
- Bug: Set compares by reference not value HOT 6
- TypeScript library for react-fast-compare? HOT 9
- Fix exported types so that they work for react-redux HOT 8
- Cannot compare object will null prototype HOT 11
- Getters are not considered HOT 2
- IE 11: Object doesn't support property or method 'isView' HOT 26
- There should be a 'debug' feature to determine which fields are breaking equality.
- Types: documentation, clean up, and testing
- Audit security alerts HOT 2
- Fix benchmark chart img path
- Ignore Arrow Functions HOT 1
- Re-evaluate project's eslint rules HOT 1
- Update benchmark png HOT 2
- Differences in objects with properties that are associative arrays are not detected HOT 8
- Infra: Switch to GitHub Actions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-fast-compare.