Reputation: 59
I'm using jimp with webpack,but the page alway show this:
Uncaught Error: define cannot be used indirect
Also I have try to add module.noParses
config in my webpack.config.js like below:
noParse: [/jimp/]
but it will console other error:
Uncaught ReferenceError: require is not defined
Just so confused,no really where the problem is,maybe the jimp is not incompatible with webpack?
Thanks in advanced.
Upvotes: 0
Views: 1091
Reputation: 11672
Ran into this myself, looks like using the imports loader helps:
import 'imports?require=>false!path/to/jimp.js'
You can also do it via webpack.config.js in module.loaders
:
{
test: /jimp/,
loader: 'imports?require=>false',
}
If you have other loaders (e.g. babel) you might also need to exclude jimp from that config as well.
Upvotes: 1