Update CopyPlugin options
This commit is contained in:
parent
c3d8855ec3
commit
bc7bf9870c
@ -19,6 +19,10 @@ describe("public folder", function () {
|
|||||||
expect(fs.existsSync(path.join(publicFolder, "thelounge.webmanifest"))).to.be.true;
|
expect(fs.existsSync(path.join(publicFolder, "thelounge.webmanifest"))).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("audio files are copied", function () {
|
||||||
|
expect(fs.existsSync(path.join(publicFolder, "audio", "pop.wav"))).to.be.true;
|
||||||
|
});
|
||||||
|
|
||||||
it("index HTML file is not copied", function () {
|
it("index HTML file is not copied", function () {
|
||||||
expect(fs.existsSync(path.join(publicFolder, "index.html"))).to.be.false;
|
expect(fs.existsSync(path.join(publicFolder, "index.html"))).to.be.false;
|
||||||
expect(fs.existsSync(path.join(publicFolder, "index.html.tpl"))).to.be.false;
|
expect(fs.existsSync(path.join(publicFolder, "index.html.tpl"))).to.be.false;
|
||||||
@ -32,6 +36,8 @@ describe("public folder", function () {
|
|||||||
it("style files are built", function () {
|
it("style files are built", function () {
|
||||||
expect(fs.existsSync(path.join(publicFolder, "css", "style.css"))).to.be.true;
|
expect(fs.existsSync(path.join(publicFolder, "css", "style.css"))).to.be.true;
|
||||||
expect(fs.existsSync(path.join(publicFolder, "css", "style.css.map"))).to.be.true;
|
expect(fs.existsSync(path.join(publicFolder, "css", "style.css.map"))).to.be.true;
|
||||||
|
expect(fs.existsSync(path.join(publicFolder, "themes", "default.css"))).to.be.true;
|
||||||
|
expect(fs.existsSync(path.join(publicFolder, "themes", "morning.css"))).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
it("style files contain expected content", function (done) {
|
it("style files contain expected content", function (done) {
|
||||||
@ -55,4 +61,15 @@ describe("public folder", function () {
|
|||||||
expect(fs.existsSync(path.join(publicFolder, "js", "loading-error-handlers.js"))).to.be
|
expect(fs.existsSync(path.join(publicFolder, "js", "loading-error-handlers.js"))).to.be
|
||||||
.true;
|
.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("service worker has cacheName set", function (done) {
|
||||||
|
fs.readFile(path.join(publicFolder, "service-worker.js"), "utf8", function (err, contents) {
|
||||||
|
expect(err).to.be.null;
|
||||||
|
|
||||||
|
expect(contents.includes("const cacheName =")).to.be.true;
|
||||||
|
expect(contents.includes("__HASH__")).to.be.false;
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -91,9 +91,11 @@ const config = {
|
|||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: "css/style.css",
|
filename: "css/style.css",
|
||||||
}),
|
}),
|
||||||
new CopyPlugin([
|
new CopyPlugin({
|
||||||
|
patterns: [
|
||||||
{
|
{
|
||||||
from: "./node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff*",
|
from:
|
||||||
|
"./node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff*",
|
||||||
to: "fonts/[name].[ext]",
|
to: "fonts/[name].[ext]",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -103,7 +105,9 @@ const config = {
|
|||||||
{
|
{
|
||||||
from: "./client/*",
|
from: "./client/*",
|
||||||
to: "[name].[ext]",
|
to: "[name].[ext]",
|
||||||
ignore: ["index.html.tpl", "service-worker.js"],
|
globOptions: {
|
||||||
|
ignore: ["**/index.html.tpl", "**/service-worker.js"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: "./client/service-worker.js",
|
from: "./client/service-worker.js",
|
||||||
@ -111,7 +115,10 @@ const config = {
|
|||||||
transform(content) {
|
transform(content) {
|
||||||
return content
|
return content
|
||||||
.toString()
|
.toString()
|
||||||
.replace("__HASH__", isProduction ? Helper.getVersionCacheBust() : "dev");
|
.replace(
|
||||||
|
"__HASH__",
|
||||||
|
isProduction ? Helper.getVersionCacheBust() : "dev"
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -126,7 +133,8 @@ const config = {
|
|||||||
from: "./client/themes/*",
|
from: "./client/themes/*",
|
||||||
to: "themes/[name].[ext]",
|
to: "themes/[name].[ext]",
|
||||||
},
|
},
|
||||||
]),
|
],
|
||||||
|
}),
|
||||||
// socket.io uses debug, we don't need it
|
// socket.io uses debug, we don't need it
|
||||||
new webpack.NormalModuleReplacementPlugin(
|
new webpack.NormalModuleReplacementPlugin(
|
||||||
/debug/,
|
/debug/,
|
||||||
|
Loading…
Reference in New Issue
Block a user