System.js es6 system modules cannot be started

According to the beginning of work, I created the main.js file:

export class q { constructor() { this.es6 = 'yay'; } } 

In my html file received:

 <script src="system.js"></script> <script> SystemJS.import('main.js') .then(null,(err)=>console.error(err)) </script> 

When the page loads, I get:

Error: Unable to dynamically reload the ES module. The bootloader plugin must be configured through SystemJS.config({ transpiler: 'transpiler-module' }) . Creating http: // localhost: 8080 / main.js Loading main.js on forwarding (system.js: 3650) to system.js: 3433 SystemJS.import.then @ index.html: 17

The system.js file I got from here: https://raw.githubusercontent.com/systemjs/systemjs/master/dist/system.src.js

Running static content from an http server (node) with a caching plugin installed in Chrome.

Not sure what it is, but I will continue to read the documents and maybe find a solution. A little sloppy so that it breaks at startup.

Update

I assume this has something to do with it:

https://github.com/jspm/jspm-cli/issues/1312

But nothing is said about how to make a mistake. The code works in Chrome and will be transmitted using babel, only part I need system.js for development is to download the module.

Update

https://youtu.be/5P04OK6KlXA?t=3m3s

It seems that the β€œstart of work” should indicate that, for example, the work should also be monitored.

After some searching, I found traceur.js here: http://google.imtqy.com/traceur-compiler/bin/traceur.js

Changed html:

 <script src="traceur.js"></script> <script src="system.js"></script> <script> SystemJS.import('./main.js') .then(null,(err)=>console.error(err)) </script> 

And this is the same mistake.

Update

Installed systemjs and traceur with npm number and added them to html:

 <script src="./node_modules/traceur/bin/traceur.js"></script> <script src="./node_modules/systemjs/dist/system.js"></script> 

The same mistakes. I am done with this and will return to requirejs for development, r.js with uglify for distribution.

I studied this after reading something about folding and how the compiled code can be smaller when it imports only what you need, not the whole file.

+5
source share

Source: https://habr.com/ru/post/1263867/


All Articles