@
@
@Richswitch2018-03-08 09:30:46
JavaScript
@Richswitch, 2018-03-08 09:30:46

How to easily move a file from one folder to another using Webpack?

Hey! Explain how you can easily (without other manipulations) move files from one folder to another
using Webpack ? For example, from src / js to dist / js Fonts "move" for me like this

{
        test: /\.(eot|ttf|woff|woff2)$/,
        loader: 'file-loader',
        options: {
          name: '/[name]/[name].[ext]',
          outputPath: 'fonts/',
        },
      },

But I can't write a relative path to test (for example: ../js/*.js ). And with the help of regular expressions, such a query is not enough knowledge to write

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Epifanov, 2018-03-08
@kacheleff

test does not specify a relative path, but a regular expression. By parsing this regular expression, webpack will understand which files to apply the loader to.
In order to write the correct regular expression, you need to know which files you need to move.
for example, there is an online regular expression tester here, you can practice there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question