MattKetmo / darkroomjs

Extensible image editing tool in your browser
https://mattketmo.github.io/darkroomjs
MIT License
1.41k stars 406 forks source link

Can not resolve module darkroom #78

Closed ghost closed 8 years ago

ghost commented 8 years ago

I am using nodejs and webpack, and problem appears when i am trying to include Darkroom like

var Darkroom = require('darkroom');

Node js and Webpack can not find this module in node_modules, what i am doing wrong?

MattKetmo commented 8 years ago

Next release is written with webpack and will expose darkroom as a valid npm module. See #79.

jakeorr commented 7 years ago

For future reference, here's how I got Darkroom v2 to work with webpack:

yarn add exports-loader --dev (or npm, whichever you like)

webpack.config.js:

resolve: {
  alias: {
    darkroom: 'darkroom/lib/js/core/darkroom',
  },
},
module: {
  loaders: [{
    include: require.resolve('darkroom/lib/js/core/darkroom'),
    loader: 'exports?window.Darkroom',
  }],
},

Now I am able to import Darkroom from 'darkroom'; in my component. require should work as well.

jakeorr commented 7 years ago

Whoops, spoke too soon. The package doesn't currently build on install. Would be great to see v3, but for now I'm just going to look for another package.