+ 5
Code Bits ES6 Module
is it possible to use es6 module in code bits/playground ? because we cant really modify the script tag here https://www.sololearn.com/discuss/1727204/?ref=app related topic i can find, not really answer how. all i have is an error "cannot use import outside module" when trying to import a module
18 odpowiedzi
+ 5
Calvin created a demo for dynamic importing a js module a couple of months ago. It may help solve your dilemma.
https://code.sololearn.com/WoR3yeFp6pSe/#html
You will need to change the source due to CORS
'https://cors-anywhere.herokuapp.com/https://testmod.glitch.me/test.js'
+ 5
Taste ES6 Modules are supported in Playground.
Just leave the src attribute out of the following line:
<script type="module">
import a from src_url
</script>
I've created a simple demo to show that import from external reference does load.
https://code.sololearn.com/WGsS5OnXK3In/?ref=app
+ 2
Taste Ohh So you mean Sololearn link the html , css and js automatically.. Yeah That is a problem then.. From my side I see no solution. You could contact the team though.
+ 2
yes, but the completed project need ES6 module..
i guess there's no other way than bloat the html page with the js
+ 2
i do use github, the master plan of this code i'm working on is creating collaborative project between sololearn user.
who know how it'll work or not
+ 1
Totally off topic but you do not see a dog helping a cat everyday.
+ 1
it was my solution, but doesnt optimal with 200+ lines of js.
SL editor in my device start lagging around 150lines of codes
0
Taste You mean like use ES6 features in code playground?
0
the module feature to be exact
like
import { a } from "http://example.com/a_module.js"
0
Taste Do other es6 features work?
0
it should. the main problem with es6 module is i need a type attribute for the script tag
<script type="module" src="script.js">
but code bits/playground import the js code automaticly to html.
0
For me..!!!
Do code in ur regular code editors..!! Like VS code, Sublime, etc...
SoloLearn is juzt a platform to exhibit ur completed projects..
Best way to use ES6 Modules r only in ur personal PC 😁
PS : All these r my exp wordz.. not to insist anything wrong😊
0
Yup... I do think so..!!!
I'd suggest u to publish ur code on some other good platforms😅 GitHub is there...!!
0
oooooh yes, its totally possible
0
its done, sort of
https://code.sololearn.com/WJpzGA72Ohv4/?ref=app
0
Dffthdhdyxhyehxheyhet3yxhrhxhy4hxgegd hyd
0
Fctchhjbhvtvtvyh
0
Dxfctvghhhhhb6jtbuj