英文:
How to ignore/exclude CNAME record in WorkboxPlugin.GenerateSW
问题
I have a website and I deploy it using gh-pages. I've included the CNAME record in the build folder to point the GitHub page to my subdomain. When I use the WorkboxPlugin, it also includes the CNAME record. I'm unable to exclude the file.
new WorkboxPlugin.GenerateSW({
clientsClaim: true,
skipWaiting: true,
exclude: [
/\.map$/, // source maps
/^manifest.*\.js(?:on)?$/, // web app manifest
],
}),
new CopyWebpackPlugin({
patterns: [
{
from: path.join(__dirname, '../public/manifest.json'),
to: path.join(__dirname, '../build/manifest.json'),
},
{
from: path.join(__dirname, '../public/favicon.ico'),
to: path.join(__dirname, '../build/'),
},
{
from: path.join(__dirname, '../public/CNAME'),
to({ context, absoluteFilename }) {
return Promise.resolve('../build/[name]');
},
},
],
}),
英文:
I've a website and I deploy it using gh-pages. I've include the CNAME record in the build folder to point the GitHub page to my subdomain. When I use the WorkboxPlugin it also includes the CNAME record. I'm unable to exclude the file.
new WorkboxPlugin.GenerateSW({
clientsClaim: true,
skipWaiting: true,
exclude: [
/\.map$/, // source maps
/^manifest.*\.js(?:on)?$/, // web app manifest
],
}),
new CopyWebpackPlugin({
patterns: [
{
from: path.join(__dirname, '../public/manifest.json'),
to: path.join(__dirname, '../build/manifest.json'),
},
{
from: path.join(__dirname, '../public/favicon.ico'),
to: path.join(__dirname, '../build/'),
},
{
from: path.join(__dirname, '../public/CNAME'),
to({ context, absoluteFilename }) {
return Promise.resolve('../build/[name]');
},
},
],
}),
答案1
得分: 0
添加/CNAME/会排除CNAME记录。
英文:
Adding /CNAME/ excludes the CNAME record
new WorkboxPlugin.GenerateSW({
clientsClaim: true,
skipWaiting: true,
exclude: [
/\.map$/, // source maps
/^manifest.*\.js(?:on)?$/, // web app manifest
/CNAME/,
],
})
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论