swimlane / ngx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular
http://swimlane.github.io/ngx-datatable/
MIT License
4.63k stars 1.68k forks source link

Zone Already loaded Angular 6.1.0 // ngx-datatable 13.1.0 #1505

Open moshejs opened 6 years ago

moshejs commented 6 years ago

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior Angular SSR --> npm run serve:ssr --> "Zone already loaded"

Expected behavior it should compile and run without an issue

Reproduction of the problem run npm run serve:ssr on an SSR build

What is the motivation / use case for changing the behavior?

This will work on SSR Angular applications

Please tell us about your environment:

Windows, Mac, WebStorm, Express, Node (least)

Frosty1604 commented 6 years ago

I got the same problem. I don't know if it's coming from ngx-datatable module or from another module but it would be very nice to get help or see a fix for that!

moshejs commented 6 years ago

@Frosty1604 It's definitely coming from the datatable module, I was able to isolate the problem by upgrading, then downgrading and the problem was gone.

Frosty1604 commented 6 years ago

@moshejs To what versions did you down- and upgrade? And thanks for th clarification.

moshejs commented 6 years ago

@Frosty1604 version 13.1.0 gave me trouble, downgraded to 13.0.1 and works like a charm

Frosty1604 commented 6 years ago

@moshejs very strange... I got the error first in version 13.0.1 and upgraded to 13.1.0 and the error still persists. I also tried the way you did, but unfortunately it didn't worke for me.

moshejs commented 6 years ago

@Frosty1604 make sure your package.json includes: "@swimlane/ngx-datatable": "13.0.1", and not "@swimlane/ngx-datatable": "^13.0.1",

Frosty1604 commented 6 years ago

Thanks but this didn't help neither. I saw another way to handle this error. You can download the package webpack-node-externals and then in the webpack.server.config.js: const nodeExternals = require('webpack-node-externals');

module.exports = {
    entry: { server: './server.ts' },
    resolve: { extensions: ['.js', '.ts'] },
    target: 'node',
    mode: 'none',
    externals: [nodeExternals()], // change this to nodeExternals()
    output: {
        path: path.join(__dirname, 'dist'),
        filename: '[name].js'
    },
smitha272 commented 6 years ago

@moshejs @Frosty1604 I am facing this issue as well. I tried upgrading/downgrading ngx-datatable and changing webpack.config.js.

I have a question though, Are either of your applications a Angular Hybrid Application? (Angular 5 and Angularjs used together)?

@amcdnl Can there be a reason to see this error because of using ngx-datatable in a hybrid application? I see issue #1098 that looks similar, and it is open. That's why wondering.

Really appreciate any help regarding this. TIA!