nathansmith / unsemantic

Fluid grid for mobile, tablet, and desktop.
http://unsemantic.com
MIT License
1.38k stars 161 forks source link

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

Closed eliranmal closed 8 years ago

eliranmal commented 8 years ago

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!

nathansmith commented 8 years ago

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 commented 8 years ago

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:

https://github.com/nathansmith/unsemantic/commit/15c1f94b438f76fcf446c27da0ed0f97883554d2

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 commented 8 years ago

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

cheers :)