ag-grid / ag-grid-aurelia

Aurelia wrapper for ag-Grid project
MIT License
23 stars 8 forks source link

support new aurelia-webpack-plugin #18

Closed nashwaan closed 7 years ago

nashwaan commented 7 years ago

Added PLATFORM.moduleName() to support new aurelia-webpack-plugin. See discussion in https://github.com/aurelia/webpack-plugin/issues/96 for more info.

swalters commented 7 years ago

main.js is missing PLATFORM variable.

var PLATFORM = require('aurelia-pal').PLATFORM;

should be added to top of main.js

nashwaan commented 7 years ago

I added this line to top of main.js

var PLATFORM = require('aurelia-pal').PLATFORM;

But I got several errors after running npm run build.

Then I changed it to

var PLATFORM = require('aurelia-framework').PLATFORM;

And I still get same errors:

[17:08:43] Using gulpfile ~\Documents\ag-grid-aurelia-nashwaan\gulpfile.js
[17:08:43] Starting 'default'...
src\agGridAurelia.ts(13,8): error TS2307: Cannot find module 'aurelia-framework'.
src\agGridAurelia.ts(14,80): error TS2307: Cannot find module 'ag-grid/main'.
src\agGridAurelia.ts(25,57): error TS7006: Parameter 'property' implicitly has an 'any' type.
src\agGridAurelia.ts(60,39): error TS7006: Parameter 'eventName' implicitly has an 'any' type.
src\agGridColumn.ts(1,70): error TS2307: Cannot find module 'aurelia-framework'.
src\agGridColumn.ts(2,22): error TS2307: Cannot find module 'ag-grid/main'.
src\agTemplate.ts(1,84): error TS2307: Cannot find module 'aurelia-framework'.
src\agUtils.ts(1,64): error TS2307: Cannot find module 'aurelia-framework'.
src\aureliaCellRendererComponent.ts(1,29): error TS2307: Cannot find module 'ag-grid/main'.
src\aureliaCellRendererComponent.ts(2,20): error TS2307: Cannot find module 'aurelia-templating'.
src\aureliaComponentFactory.ts(1,78): error TS2307: Cannot find module 'aurelia-framework'.
src\aureliaComponentFactory.ts(3,50): error TS2307: Cannot find module 'ag-grid/main'.
src\aureliaFrameworkFactory.ts(1,77): error TS2307: Cannot find module 'aurelia-framework'.
src\aureliaFrameworkFactory.ts(11,8): error TS2307: Cannot find module 'ag-grid/main'.
[17:08:44] TypeScript: 14 semantic errors
[17:08:44] TypeScript: emit succeeded (with errors)
[17:08:44] Finished 'default' after 1.34 s
swalters commented 7 years ago

ag-grid and aurelia are peer dependencies. You need to npm install each one individually.

  "peerDependencies": {
    "aurelia-framework": "^1.0.0",
    "ag-grid": "9.1.x"
  },

You should also update the aurelia-framwork dependency in package.json to the minimum required version for PLATFORM.moduleName.

var PLATFORM = require('aurelia-pal').PLATFORM; works for me.

As you can see, there is rarely a such thing as a quick 3 line change :(

nashwaan commented 7 years ago

Now it works after installing aurelia-framwork and ag-grid. I wasn't familiar with "peerDependencies" concept as I think this more used by library developers.

And yes I agree: 3 line change is too good to be true. 😊

seanlandsman commented 7 years ago

thanks for the PR guys!