0

How to change the output directory of file copied with file-loader ?

Configuration :

var SRC_DIR = path.resolve(__dirname, 'src');
...
loaders : [
{
  test : /\.html$/,
  include : SRC_DIR + "/main/html",
  loader : 'file?name=[path][name].[ext]'
},
  • If I use [path], output = full source directory.
  • If I don't, output=files are on root output directory

How to keep only a part of the initial path ?

Example :

 source : /src/main/html/app/sample.html
 output : /dist/app/sample.html
user2668735
  • 1,048
  • 2
  • 18
  • 30

1 Answers1

1

You can try this (I haven't tested it)

plugins: [
     ...
     new CopyWebpackPlugin([
       { from: SRC_DIR + "/main/html" }
     ]),
     ...
  ]
user2668735
  • 1,048
  • 2
  • 18
  • 30
Jinex2014
  • 334
  • 3
  • 5