Systemjs: not found in '../libs/system'

Created on 9 May 2020  ·  2Comments  ·  Source: systemjs/systemjs

I use systemjs like this:

import * as SystemJS from '../libs/system';
but when i use webpack build this index.js file, it's waring:
image
There's no problem with the path: ‘../libs/system’。

Most helpful comment

Hi @kukuyu, good question. We generally discourage bundling systemjs with webpack, and instead encourage loading via script tag. If you'd like to bundle systemjs, you should note that it does not expose any ESM or CJS exports from its main file and so you should not do import * as SystemJS from '../libs/system'. Instead, try doing import 'systemjs/dist/system.min.js';.

The reason for this is that SystemJS creates the window.System global variable which is needed for loading System.register modules. That variable must be global to facilitate script loading.

thank you !! get it !

All 2 comments

Hi @kukuyu, good question. We generally discourage bundling systemjs with webpack, and instead encourage loading via script tag. If you'd like to bundle systemjs, you should note that it does not expose any ESM or CJS exports from its main file and so you should not do import * as SystemJS from '../libs/system'. Instead, try doing import 'systemjs/dist/system.min.js';.

The reason for this is that SystemJS creates the window.System global variable which is needed for loading System.register modules. That variable must be global to facilitate script loading.

Hi @kukuyu, good question. We generally discourage bundling systemjs with webpack, and instead encourage loading via script tag. If you'd like to bundle systemjs, you should note that it does not expose any ESM or CJS exports from its main file and so you should not do import * as SystemJS from '../libs/system'. Instead, try doing import 'systemjs/dist/system.min.js';.

The reason for this is that SystemJS creates the window.System global variable which is needed for loading System.register modules. That variable must be global to facilitate script loading.

thank you !! get it !

Was this page helpful?
0 / 5 - 0 ratings