fix: specifying "main" in npm breaks webpack setups #90

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@eliranmal

is it reasonable to omit the main entry altogether?

when installing via npm and building with webpack, this breaks the webpack build as the ./assets/react/index.js will be picked up as a module and bundled, causing broken dependencies (if you don't want react in the project).

BTW, thanx! unsemantic is awesome!

@eliranmal eliranmal specifying "main" breaks webpack setups
is it reasonable to omit the `main` entry altogether? 

when installing via npm and building with webpack, this breaks the webpack build as the `./assets/react/index.js` will be picked up as a module and bundled, causing broken dependencies (if you don't want react in the project).

BTW, thanx! unsemantic is awesome!
c110a6f
@eliranmal eliranmal changed the title from specifying "main" breaks webpack setups to fix: specifying "main" in npm breaks webpack setups May 16, 2016
@nathansmith
Owner

Hmm, without specifying "main" then this wouldn't work…

import { Grid } from 'unsemantic'

Let me do some research and see if there's a different file name I can use, that might get Webpack to ignore "index.js"

@nathansmith nathansmith added a commit that referenced this pull request May 18, 2016
@nathansmith Removing "main" from package.json and creating a root index.js file, …
…so that Webpack properly builds non-React projects. Related ticket… #90
15c1f94
@nathansmith
Owner

So, as it turns out, I don't need {"main":"…"} in package.json, as long as I have an index.js file at the root. Related commit:

15c1f94

NOTE: I bumped the version number to 1.1.3.

Now, users will still be able to do…

import { Grid, GridContainer} from 'unsemantic'

…but also, Webpack won't erroneously pick up on any "main" file, because that doesn't exist in the package.json anymore.

Best of both worlds, win-win.

Thanks for bringing this to my attention.

:)

@eliranmal

awesome, thanx for that fix. i wasn't around for a while, and just saw your comments..

cheers :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment