aurelia-ui-toolkits / aurelia-syncfusion-bridge

27 stars 21 forks source link

Cannot find name 'ej' - Webpack #77

Closed MrBliz closed 6 years ago

MrBliz commented 6 years ago

Hi,

I've followed the instructions for installation with webpack

package.json


"dependencies": {
 //snipped for brevity
    "aurelia-syncfusion-bridge": "^1.2.0", 
    "syncfusion-javascript": "^15.3.33",
  },

"aurelia": {
    "build": {
      "resources": [
        "au-table",
        "aurelia-chart",
        "aurelia-syncfusion-bridge/grid/grid",
        "aurelia-syncfusion-bridge/grid/column"
      ],
      "includeDependencies": "aurelia-*"
    }

in webpack.config.js i have this line

entry: { 'app': 'aurelia-bootstrapper-webpack', 'aurelia-syncfusion-bridge': ['aurelia-syncfusion-bridge'] }, // Note: The aurelia-webpack-plugin will add your app's modules to this bundle automatically

i have this line in my boot.ts .plugin('aurelia-syncfusion-bridge', (syncfusion) => syncfusion.ejGrid());

and in my view model i have this

 public activate() {

        this.people =  ej.DataManager({ // eslint-disable-line new-cap
            url: 'http://localhost/api/people',
            crossDomain: true
        });

but i can't build the project as 'ej' is not found.

it seems ej is not being registered globally, but i'n not sure what i'm doing wrong.

mariaantony-gnanasekaran commented 6 years ago

Hi @MrBliz ,

We suspect that you didn't install Syncfusion widget's typings. So install Syncfusion widget types by executing the bellow command.

npm i @types/ej.web.all --save-dev

Also refer the Syncfusion typings in types array like the below one in tsconfig.json file

[tsconfig.json]

{
  "compilerOptions": {
    "module": "es2015",
    "moduleResolution": "node",
    "target": "es5",
    "sourceMap": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "skipDefaultLibCheck": true,
    "strict": true,
    "lib": [ "es2015", "dom" ],
    "types": [ "webpack-env","@types/ej.web.all" ]
  },
  "exclude": [ "bin", "node_modules" ],
  "atom": { "rewriteTsconfig": false }
}

We prepared sample in the below configuration and rendered our ejGrid component.

Sample

If you are still facing any issues, share your sample with us, which help us to provide you the solution at the earliest.

Thanks.

MrBliz commented 6 years ago

Thank you, very helpful.