Skip to content
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

Unable to use any third party library #3

Open
deepakzoto opened this issue May 26, 2017 · 3 comments
Open

Unable to use any third party library #3

deepakzoto opened this issue May 26, 2017 · 3 comments

Comments

@deepakzoto
Copy link

chunk   {10} vendor.19ed3429e43bd40562c9.bundle.js (vendor) 3.67 MB [initial] [rendered]
chunk   {11} inline.5313fe5b47cedb93f119.bundle.js (inline) 0 bytes [entry] [rendered]

> angular-pwa-starter@0.0.0 start D:\GitWork\web-ui
> ts-node src/server.ts

D:\GitWork\web-ui\node_modules\ng2-mask\build\ng2-mask.module.js:1
(function (exports, require, module, __filename, __dirname) { import { NgModule } from '@angular/core';
                                                              ^^^^^^
SyntaxError: Unexpected token import
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (D:\GitWork\web-ui\src\app\user\user.module.ts:10:1)

npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v7.7.4
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
@PSPanesar
Copy link

I've had the same problem with ng-bootstrap and leads to the same crash, has anyone got any ideas on how to resolve / fix this one?

@alexverdaguer
Copy link

Same problem here, I read the solutions is use isBrowser() just to render to the Browser but I don't know where are the docs.

@wnabil
Copy link

wnabil commented Jul 6, 2017

Finally found a way to make this work
there is already a project here
https://github.com/pquarme/cli-universal-demo
to include your third party libraries
open webpack.config and add them to

target: 'node',
   externals: [nodeExternals({
     whitelist: [
       /^@angular\/material/
     ]
   })],

just like
angular/material

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants