-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CreateJS and Webpack #12
Comments
You can use the imports loader and exports loader plugins to deal with this. This is the way I have it configured: resolve: {
alias: {
createjs: 'createjs/builds/1.0.0/createjs.js'
}
},
module: {
rules: [
{
test: /node_modules[/\\]createjs/,
loaders: [
'imports-loader?this=>window',
'exports-loader?window.createjs'
]
},
...
} Then you can import it normally: import createjs from 'createjs'; |
When using a typescript loader I've additionally had to use const createjs = require( 'createjs') instead of import |
Updating the loaders to version rules: [
{
test: /node_modules[/\\]createjs/,
use: [{
loader: 'exports-loader',
options: {
type: 'commonjs',
exports: 'single window.createjs',
},
}],
},
{
test: /node_modules[/\\]createjs/,
use: [{
loader: 'imports-loader',
options: {
wrapper: 'window',
},
}],
},
], |
The problem with
|
CreateJS doesn't work with web pack.
throwing in runtime: createjs.js:58 Uncaught ReferenceError: createjs is not defined
you are try to reference to this.createjs and expecting this to be a window object, but it is actually webpack module wrapper.
could you fix the referencing to exactly CreateJS instance not to this.createjs
Thank you.
The text was updated successfully, but these errors were encountered: