stackcss / sheetify

:sparkles: Modular CSS bundler for browserify
MIT License
447 stars 47 forks source link

Webpack Support #125

Open ilyaigpetrov opened 7 years ago

ilyaigpetrov commented 7 years ago

Webpack documentation suggests using transform-loader for converting browserify transforms to webpack loaders, but when started it throws error: Error: It appears that you're trying to require sheetify in the browser but it wasn't caught by the browserify transform. Either the transform has not been enabled, or the require statement could not be statically resolved.. I guess it is because of browser field in the package.json which is used for:

...the entry point when the module is packaged by a bundler for browser use.

So webpack2 bundles packages for a browser use, that seems logical to use browser field and sheetify refuses to expose it. Who's fault is it? How to fix it?

Update

I don't think that fixing browser field will be enough because webpack2 won't be able to convert const fs = require('fs') in your index.js.

yoshuawuyts commented 7 years ago

I think you probably want to require sheetify/transform until #126 lands :sparkles: