systemjs: 'use strict' breaks importing
I’m just getting into ES6 modules, but I ran into an issue that surprised me. If I import a module using strict mode ('use strict';), the entire application fails.
index.js
var System = require('systemjs');
System.import('main').then(function(m) {
console.log('loaded');
})
main.js
console.log('before import');
import { name } from './lib';
console.log('name: ' + name);
lib.js
'use strict'; // <-- Breaks app
export var name = 'Foo';
Running node index.js will silently finish without logging anything to stdout, but if I remove 'use strict'; from lib.js, I’ll get the expected output:
before import
name: Foo
loaded
Something else surprising is even if 'use strict;` is commented, the app still fails silently.
lib.js
// 'use strict';
export var name = 'Foo';
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 27 (11 by maintainers)
After further testing, it appears any string text on the first line breaks the app.
still breaks app:
but works fine if the first line is blank