Skip to content

Commit

Permalink
Issue #47 - Allow mix.copy paths to be absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
jclausen committed Feb 22, 2023
1 parent 5678b63 commit fe72d8c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/config/ingredients/copy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
const { CleanWebpackPlugin } = require("clean-webpack-plugin");

const path = require("path");

module.exports = function(from, to) {
if (this.dependencies(["[email protected]"])) {
return;
}
const CopyWebpackPlugin = require("copy-webpack-plugin");
let fromPath = from.substring( 0, 1 ) == "/"
? from
: path.resolve(
global.elixir.rootPath,
this.prefix,
from
);
let toPath = to.substring( 0, 1 ) == "/"
? to
: path.resolve(
global.elixir.rootPath,
this.prefix,
to
);;
return this.mergeConfig({
plugins: [
new CopyWebpackPlugin({ patterns: [ { from: from, to: to } ] }),
new CopyWebpackPlugin({ patterns: [ { from: fromPath, to: toPath } ] }),
new CleanWebpackPlugin({ cleanOnceBeforeBuildPatterns: [to] })
]
});
Expand Down

0 comments on commit fe72d8c

Please sign in to comment.