mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2025-01-05 10:41:56 +03:00
Fix AddFile plugin so that it correctly adds files that work in dev mode.
This commit is contained in:
parent
3b64034764
commit
76c91d6108
@ -17,13 +17,15 @@ class AddFilesPlugin {
|
|||||||
apply(compiler) {
|
apply(compiler) {
|
||||||
compiler.hooks.afterCompile.tap("AddFilesPlugin", compilation => {
|
compiler.hooks.afterCompile.tap("AddFilesPlugin", compilation => {
|
||||||
this.filesList.forEach(file => {
|
this.filesList.forEach(file => {
|
||||||
compilation.assets[path.join(file.name, "content.txt")] = {
|
// Couldn't find this documented in the webpack docs,
|
||||||
source: function() {
|
// but I found the example code for it here:
|
||||||
return file.content;
|
// https://github.com/jantimon/html-webpack-plugin/blob/35a154186501fba3ecddb819b6f632556d37a58f/index.js#L470-L478
|
||||||
},
|
|
||||||
size: function() {
|
const filename = path.join(file.name, "content.txt");
|
||||||
file.content.length;
|
compilation.fileDependencies.add(filename);
|
||||||
}
|
compilation.assets[filename] = {
|
||||||
|
source: () => file.content,
|
||||||
|
size: () => file.content.size
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user