我有一个网站,主要是用 pug(html 预处理器)编写的。我使用 output.publicPath 等于 '/' 所以我可以在开发模式下运行 webpack 并轻松工作,将项目文件夹视为根文件夹,但每个 href、src 和 url 都是绝对路径。当我构建项目时,我想通过在乞讨中添加一些节点(例如让我们使用'/path/to/')来更改每条路径。例如,我有一个图像
img(src="/img/image.jpg")
Run Code Online (Sandbox Code Playgroud)
在我构建这个项目之后,我想收到这个:
img(src="/img/image.jpg")
Run Code Online (Sandbox Code Playgroud)
并接收相同的 href 和 url。
我做了一个 webpack 构建配置并将 output.publicPath 设置为 '/path/to/' 但它更改了链接的 css 和 js 文件的路径:
<img src="/path/to/img/image.jpg">
Run Code Online (Sandbox Code Playgroud)
我很高兴收到任何解决方案、想法或建议。
我有一个未知类型的联盟。我想得到它的合并类型。例如:
const a = {
x: 10
}
const b = {
y: 'qwer'
}
const array = [a, b]
type TArr = typeof array
// I use a function which receives an array as argument so I only have type of array from now on
type TUnion = keyof TArr[number] // { x: number } | { y: string }
type TMerge = ? // { x: number } & { y: string }
Run Code Online (Sandbox Code Playgroud)
哪里TMerge几乎相同
type TMerge …Run Code Online (Sandbox Code Playgroud)