Comments (5)
🤔 I don't see how the package.json could affect the behavior of the library . How are you importing it?
from denormalizr.
It's not very difficult to reproduce. The following sample code shows what's happening:
import { schema } from 'normalizr';
import { denormalize } from 'denormalizr';
const user = new schema.Entity('user', {
group: group
});
const group = new schema.Entity('group', {
users: [user],
});
const entity = { id: 1, name: 'Lars', group: 1 };
const entities = {
user: {
1: { id: 1, name: 'Lars', group: 1 },
},
group: {
1: { id: 1, name: 'Test', users: [1] },
},
};
const result = denormalize(entity, entities, group);
// If we use [email protected] (no browser field in package.json)
console.log(result) // { id: 1, name: 'Test', users: [{ id: 1, name: 'Lars', group: [circular]}] };
// if we use [email protected] (browser field in package.json)
console.log(result) // { id: 1, name: 'Test', users: [{}] };
// If we manually remove browser field from [email protected] package.json
console.log(result) // { id: 1, name: 'Test', users: [{ id: 1, name: 'Lars', group: [circular]}] };
I'm using webpack to bundle the library, so probably it's related to webpack using the browser
field instead of the main
field.
from denormalizr.
I'm using webpack to bundle the library, so probably it's related to webpack using the browser field instead of the main field.
Interesting, thanks, this should be the reason. Are you using webpack 1?
from denormalizr.
Yes, [email protected]
to be more precise.
from denormalizr.
@larsbs this should be fixed in v0.5.2
! Thanks for the report, really appreciated 👍
Please reopen if not working as expected.
from denormalizr.
Related Issues (20)
- Support memoization HOT 11
- How does it handle circular schemas? HOT 2
- Update the README documentation HOT 4
- Typescript Support HOT 1
- Calling a function on each object after denormalization HOT 1
- Denormalizing a list doesn't work the same as in the README HOT 6
- Denormalised child objects are always empty HOT 2
- Feature request - support unpkg.com HOT 1
- Denormalizing setup problem HOT 2
- Lodash is getting duplicated in my build HOT 2
- Doesn't support using a function in getIdAttribute HOT 2
- Denormalizing a list of ids HOT 1
- Support normalizr 3.0 HOT 2
- denormalize isn't working with normalizr 3.2.1 HOT 2
- Deprecating this module HOT 1
- Null should denormalize to null HOT 2
- Update readme? Normalizr denormalize doesn't handle recursive models, denormalizr still useful for that. HOT 3
- Maximum denormalization level, how to fail on missing entity? HOT 6
- why is the second argument to denormalize required? 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 denormalizr.