我想从项目的根目录加载文件,同时利用嵌套目录结构来托管示例(运行 webpack 开发服务器的位置)。
webpack 开发服务器
devServer: {
colors: true,
contentBase: './example',
historyApiFallback: true,
inline: true,
progress: true
}
示例/index.html
<!-- how do i access you `node_modules`! -->
<link href="node_modules/path/to/file.css" rel="stylesheet">
<script src="node_modules/path/to/file.js"></script>
<script src="bundle.js"></script>
.
除了将 contentBase 设置为(root)之外,还有什么方法可以实现这一点?