dy / settings-panel

Control panel for app, demo or tests
https://dy.github.io/settings-panel/
MIT License
70 stars 3 forks source link

Webpack compatibility? #7

Closed RanzQ closed 8 years ago

RanzQ commented 8 years ago

Cool project! I guess it is meant to be used with browserify, so webpack has a problem with fs.readFileSync. Anyone knows a workaround?

dy commented 8 years ago

I am not adept of webpack and I don't see simple workarounds. I guess including bundled w/browserify package is the simplest way for now, unless there is some fs transform for webpack, like brfs for browserify.

RanzQ commented 8 years ago

I tried to use webpack transforms with pixi.js too but ended up importing the bundled version. I'm not sure how common it is but would it be pointless to include the bundle in this repo? In a lib/ path for example.

UPDATE: Ok, there is a fix now for the problem I was having with pixi v4. So, I'll try with that ify-loader first. :)

RanzQ commented 8 years ago

It works with the ify-loader but with a caveat, devtool must be set to source-map since eval throws a ReferenceError: Panel is not defined.

I think this discussion is related: https://github.com/webpack/webpack/issues/417#issuecomment-52914271

And I found this: https://github.com/facebook/flux/issues/45#issuecomment-54552950

So adding strictify to your package.json solved it (it adds 'use strict'; to every module):

  "browserify": {
    "transform": [
      "brfs",
      "strictify"
    ]
  },
RanzQ commented 8 years ago

https://github.com/dfcreative/settings-panel/pull/8

dy commented 8 years ago

I guess we found workaround.