Skip to content

How to use System.import with webpack #2302

Closed
@zolekm

Description

@zolekm
  1. OS Mac OSX (El Capitan)
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
    angular-cli: 1.0.0-beta.15
    node: 6.2.2

Is there any good example how import some node_module in runtime, or/and which is right way to import dependency/reference in runtime.

With SystemJs i do that in runtime directly from node_module but with webpack i think i need to add somehow that to webpack bundle?

Example what i'm trying:

System.import('demopackage').then((data)=>{
//here i want to use that import, that already work in SystemJs version
});

Error i got:

error_handler.js:45 EXCEPTION: Cannot find module 'demopackage'

If i use demopack module with classic import statement than everything works

Main reason to do that and not use import 'dep' from 'some_module' is because i want to read imports from config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions