meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation
http://camanjs.com
BSD 3-Clause "New" or "Revised" License
3.56k stars 406 forks source link

canvas is not defined #218

Open Madhivarman opened 7 years ago

Madhivarman commented 7 years ago

I am trying to integrate CamanJs with the application but when i tried to run the error it shows canvas is not defined

i installed canvas using

npm install canvas

i included 'canvas' in externals in webpack.config.js still there is a error

externals : [ 'canvas' ],

error it shows

@http://localhost:8100/build/main.js:115815:1
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:74369:14
@http://localhost:8100/build/main.js:74198:1
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:74163:64
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:115776:75
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:105867:73
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:78067:70
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:63:18
@http://localhost:8100/build/main.js:1:1

my Ionic Information

global packages:

I am trying to integrate CamanJs with the application but when i tried to run the error it shows canvas is not defined

i installed canvas using

npm install canvas

i included 'canvas' in externals in webpack.config.js still there is a error

externals : [ 'canvas' ],

error it shows

@http://localhost:8100/build/main.js:115815:1
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:74369:14
@http://localhost:8100/build/main.js:74198:1
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:74163:64
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:115776:75
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:105867:73
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:78067:70
webpack_require@http://localhost:8100/build/main.js:20:12
@http://localhost:8100/build/main.js:63:18
@http://localhost:8100/build/main.js:1:1

my Ionic Information

global packages:

@ionic/cli-utils : 1.4.0 Ionic CLI : 3.4.0

local packages:

@ionic/app-scripts : 1.3.7 @ionic/cli-plugin-ionic-angular : 1.3.1 Ionic Framework : ionic-angular 3.4.2

System:

Node : v8.0.0 OS : Linux 4.6 Xcode : not installed ios-deploy : not installed ios-sim : not installed npm : 5.0.3

AnySolution for this..ThankYou..

sSeewald commented 7 years ago

You can simply set 'export' to undefined and inject the window context with the imports-loader.

import 'imports-loader?exports=>undefined,require=>false,this=>window!caman-dist-only';