Webpack在错误的目录中寻找装载程序?

时间:2018-09-07 15:18:45

标签: webpack gulp webpack-4 gulp-webpack

我正在从webpack-stream运行webpack。考虑以下代码

gulp.task("scripts", () => {
  return gulp
    .src("./app/assets/scripts/App.js")
    .pipe(
      gulpWebpack(
        {
          output: {
            filename: "bundle.js"
          },

          module: {
            rules: [
              {
                test: /\.(js|jsx)$/,
                exclude: /(node_modules)/,
                loader: "babel-loader",
                query: {
                  presets: [["latest", { modules: false }]]
                }
              }
            ]
          }
        },
        webpack
      )
    )
    .pipe(gulp.dest("./app/temp/scripts"));
});

它给出以下错误:-

Module build failed (from ./node_modules/babel-loader/lib/index.js):
(SystemJS) ENOENT: no such file or directory, open 'D:\@Udemy Courses\Git A Web Developer Job\course\D:\@Udemy Courses\Git A Web Developer Job\course\node_modules\babel-loader\lib\index.js'
        Error: ENOENT: no such file or directory, open 'D:\@Udemy Courses\Git A Web Developer Job\course\D:\@Udemy Courses\Git A Web Developer Job\course\node_modules\babel-loader\lib\index.js'
        Error loading D:/@Udemy Courses/Git A Web Developer Job/course/D:\@Udemy Courses\Git A Web Developer Job\course\node_modules\babel-loader\lib\index.js

如果您仔细观察错误代码中的路径,则可以看到它正在重复两次。例如

D:/course

显示为

D:/course/D:/course/node_modules

我该如何解决?

0 个答案:

没有答案