gpt4 book ai didi

build - 从子目录提供Webpack构建的 Assets

转载 作者:行者123 更新时间:2023-12-04 06:17:20 25 4
gpt4 key购买 nike

在我看到的所有示例中,入口点html文件(例如index.html)与webpack发出的所有已构建 Assets 并存。

build/
index.html
bundle.js
1.bundle.js
2.bundle.js
etc

我想将入口点html与已建 Assets 分开:
index.html
build/
bundle.js
1.bundle.js
2.bundle.js
etc

使用webpack可以吗?

最佳答案

啊哈,想通了。在webpack.config中,您必须设置output.publicPath。该路径用于在CSS中为所有相对URL加上前缀。

就我而言,我使用了:

output: {
path: path.resolve('./build'),
publicPath: './build/',
filename: '[name].bundle.js'
},

http://webpack.github.io/docs/configuration.html#output-publicpath

关于build - 从子目录提供Webpack构建的 Assets ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31129631/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com