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

Steal gets confused when script contains *System.register* #1500

Closed
1 of 5 tasks
kayahr opened this issue Jul 11, 2019 · 1 comment · Fixed by #1501
Closed
1 of 5 tasks

Steal gets confused when script contains *System.register* #1500

kayahr opened this issue Jul 11, 2019 · 1 comment · Fixed by #1501
Assignees

Comments

@kayahr
Copy link

kayahr commented Jul 11, 2019

How often can you reproduce it?

  • Always
  • Sometimes
  • Rarely
  • Unable
  • I didn’t try

Description:

When a script contains the text System.register then StealJS seams to assume that this file is a SystemJS module. That would be fine if the file actually did call System.register() but actually my script calls FileSystem.registerFileSystem() which has nothing to do with SystemJS. Looks like the regular expression which looks for System.register is not exact enough. Maybe it could simply be changed to /\bSystem\.register/?

Steps to reproduce:

Try to load a file with the following content:

require("fs.js");
FileSystem.registerFileSystem();

Expected results:

Steal should load the dependency fs.js (or complain that this file could not be loaded).

Actual results:

The error ReferenceError: require is not defined is thrown: I think this is because StealJS assumes the file is a SystemJS module instead of a CommonJS module and therefor doesn't provide the require function.

Remove the second line in the example or change it so it doesn't match System.register and then it works correctly.

Environment:

Software Version
Steal version 2.2.1
Steal-tools version -
node -v -
npm -v -
Browser Chrome 75.0.3770.100
Operating system Debian Linux 10
@matthewp
Copy link
Member

Thanks! Happy to accept a PR for \b if that does indeed fix it. Otherwise you can set the meta config to whatever you need.

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

Successfully merging a pull request may close this issue.

4 participants