・「script」タグに「type=”module”」を追加
・import文で指定されているファイルパスを相対パスでjsつき
参考: https://teratail.com/questions/216443
実装しようとしたコード、スタイルシートを読み込む
stylesheet.js
var stylesheet = function(){}
stylesheet.prototype.load = function(ipath){
var lhead = document.head;
var llink = document.createElement("link");
llink.type = "text/css";
llink.rel = "stylesheet";
llink.href = ipath;
lhead.appendChild(llink);
}
export default stylesheet;
core.js
import stylesheet from './stylesheet.js';
//CSS読み込み
var ostylesheet = new stylesheet();
ostylesheet.load("/resource/css.css");
JavaScriptくん難しいね