Comments (9)
Oops, seems like I spoke too soon: the problem isn't just about amd vs globals, but also with <script type="module">
vs traceur-compiled modules.
The es6.js
file above compiles in runtime, with <script type="module">
to:
(function(global
/**/) {
var __moduleName = "es6";
with (global) {
var amdAnswer = __moduleDependency0["default"];
console.log(amdAnswer());
var globalAnswer = __moduleDependency1["default"];
console.log(globalAnswer());
}
})
And, with traceur --modules=amd
to:
define(["amd", "global"], function($__0,$__1) {
"use strict";
var __moduleName = "es6";
var amdAnswer = ($__0).default;
console.log(amdAnswer());
var globalAnswer = ($__1).default;
console.log(globalAnswer());
return {};
});
While using the system.js
file, the <script type="module">
works fine, but the traceur
one doesn't work at all (not even with the amd module). The behavior I described earlier (only amd working) happens when using system-amd-production
.
Am I using the wrong command-line switches, or doing something overall stupid? :)
from systemjs.
Yeah globals only create a Module object when there are multiple globals written.
Yes there is a compatibility issue in the modules output for Traceur.
We've been working on this here - google/traceur-compiler#785
Once that pull request is in (hopefully today or tomorrow) I will update the compatibility layer and we should be good.
from systemjs.
Once that pull request is in (hopefully today or tomorrow) I will update the compatibility layer and we should be good.
Great to hear! Let me know if I can help with something.
Yeah globals only create a Module object when there are multiple globals written.
Interestingly, with a system.js
-compiled es6 module (be it via <script type="module">
or via System.import()
), both amd.js
and globals.js
load as expected.
The issue happens only when loading a traceur-compiled module with system-amd-production.js
. The amd module loads okay, but the global value isn't wrapped.
I can setup a repository to reproduce this if you think it helps.
from systemjs.
Yes this is completely an ES6 / transpiled ES6 interop issue which we've sorted (at least unless I've completely overlooked something).
Help testing this stuff out is amazing, so thanks for that.
from systemjs.
@Riccieri this has been fixed now in the latest versions of SystemJS (0.5.0), ES6 Module Loader (0.5.1) and Traceur (master branch).
For AMD compilation, until Traceur release 0.0.26, you will need to use the master branch of traceur, by cloning the repo, and running make
, then using the traceur executable from the bin folder.
If you have any problems at all please let me know.
from systemjs.
That's great to hear, thanks! I will try the latest versions and report back.
this has been fixed now in the latest versions of SystemJS (0.5.0), (...)
Could you add a tag to github for SystemJS 0.5.0? It makes it easier to manage with bower. Thanks!
from systemjs.
Thanks for reminding me - I've tagged it now.
from systemjs.
From my testing, there aren't any issues anymore, so I'm closing this issue.
Thanks for the great work!
from systemjs.
Great to hear that, thanks.
from systemjs.
Related Issues (20)
- fetch-load.js is not ES5 compatible in 6.14.0 HOT 3
- Where I can see example how to use systemjs with new angular version (14 or 15)
- import with npm
- How to register a module by API HOT 3
- systemjs load css suport url(image/test.svg) without quotes in url
- setupProxy.js file not working in single-spa-react
- Apply CSS from nested dependency HOT 2
- worker-load.js conflicts with fetch-load.js and prevents systemjs-babel from working in a web worker
- Updating systemjs from 0.21.5 to latest (6.14.1)
- lastScript detection doesn't seem to be 100% reliable HOT 3
- [NodeJS] Should System.import('my-module') refetch if called twice? HOT 2
- Multiple dependencies bundled in one file (previously "bundles" config option)
- Distribution Files published to npm do not match what is in GitHub for version 16.14.2 (have windows style line breaks)
- Definitelytyped types for system-node.cjs HOT 1
- Top-level await does not wait for its dependencies
- system.min.js doesn't include latest version HOT 1
- Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection') HOT 1
- Support fetchPriority with external import maps HOT 1
- Conflicting SystemJS instances — how to resolve? HOT 6
- Content Security Policy `unsafe-eval` and `unsafe-inline` still required? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from systemjs.