翻过高山走不出你
根据你的代码我写了个 demo ,没发现问题。<!-- index.html --><body><div id="app"></div><script src="bundle.js"></script></body>// a.jsmodule.exports=" world";// entry.jsvar oApp=document.getElementById('app');var a=require("./a");require("./style.css");
oApp.innerHTML="<h3>hello</h3>"+a;/* style.css */body { background-color: #aaa}// webpack.config.jsmodule.exports = { entry: './entry.js', output: { filename: 'bundle.js'
}, module: { rules: [
{ test: /.css$/, use: [ "style-loader", "css-loader"
]
}
]
}
}{ "name": "package.json", "version": "1.0.0", "description": "", "main": "index.js", "dependencies": {},
"devDependencies": { "css-loader": "^0.26.1", "style-loader": "^0.13.1", "webpack": "^2.2.0-rc.4"
}, "scripts": { "start": "webpack -w", "test": "echo \"Error: no test specified\" && exit 1"
}, "keywords": [], "author": "", "license": "ISC"}