Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Webpack 网页包-复制某些文件并保留其各自的原始路径_Webpack - Fatal编程技术网

Webpack 网页包-复制某些文件并保留其各自的原始路径

Webpack 网页包-复制某些文件并保留其各自的原始路径,webpack,Webpack,我基本上有这样的工作空间: 我有这个实际的网页配置: module.exports = { plugins: [ new CopyWebpackPlugin([ { from: 'src/**', test: /\.lua?$/, to: 'resources', transformPath (targetPath, absolutePath) { conso

我基本上有这样的工作空间:

我有这个实际的网页配置:

module.exports = {
  plugins: [
    new CopyWebpackPlugin([
        {
          from: 'src/**',
          test: /\.lua?$/,
          to: 'resources',
          transformPath (targetPath, absolutePath) {
              console.log(targetPath)
              console.log(absolutePath)
            return targetPath;
          }
        }
      ], { debug: 'info' })
  ],
  entry: {
    "resources/[Test]/izitest/izitest_server": "./src/[Test]/izitest/main.ts"
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: "ts-loader",
        exclude: /node_modules/
      }
    ]
  },
  resolve: {
    extensions: [".tsx", ".ts", ".js"]
  },
  output: {
    path: __dirname,
    filename: "[name].js"
  },
  node: {
    fs: "empty"
  }
};
我想将所有.lua文件从
/src
目录复制到
/resources
并保留其原始位置。 比如,文件
A.lua
src/moduleA/A.lua
转到
resources/moduleA/A.lua

我试图实现一个
转换路径
,但没有成功

另外,看起来
test
没有返回所有
.lua
文件,因为他也捕获了
.ts

有什么独创的方法吗