File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -118,10 +118,11 @@ module.exports = function() {
118
118
}
119
119
if ( data . html ) {
120
120
data . html = data . html . trim ( ) ;
121
- if ( data . js ) {
122
- data . html += "\n\n<script type=\"module\">\n" + data . js + "\n</script>" ;
123
- data . js = "" ;
124
- }
121
+ }
122
+ if ( data . js && data . js . indexOf ( 'import' ) > - 1 ) {
123
+ var jsAsModule = "<script type=\"module\">\n" + data . js + "\n</script>" ;
124
+ data . html = data . html ? data . html + "\n\n" + jsAsModule : jsAsModule ;
125
+ data . js = "" ;
125
126
}
126
127
if ( data ) {
127
128
cleanCodePenData ( data ) ;
Original file line number Diff line number Diff line change @@ -67,7 +67,8 @@ describe("bit-docs-html-codepen-link", function() {
67
67
css : 'my-app {color: "green";}'
68
68
} ,
69
69
{
70
- js : 'import {DefineMap} from "//unpkg.com/can@^5.0.0-pre.1/core.mjs";\nconsole.log( myCounter.count ) //-> 1' ,
70
+ html : '<script type="module">\nimport {DefineMap} from "//unpkg.com/can@^5.0.0-pre.1/core.mjs";\nconsole.log( myCounter.count ) //-> 1\n</script>' ,
71
+ js : '' ,
71
72
js_module : true ,
72
73
editors : '0011'
73
74
}
You can’t perform that action at this time.
0 commit comments