Webpack突然崩溃了

2024-04-16

一周前,它运行良好。现在,没有任何更改(相同的电脑和完全相同的文件 - 与存储库没有差异),之后npm install它不再工作并崩溃并出现以下错误:

user@machine:~/workspace/work/project$ npm run build

> [email protected] /cdn-cgi/l/email-protection build /some_outer_path/some_path/workspace/work/project
> rimraf dist && webpack --progress --profile --bail

 10% building modules 3/12 modules 9 active ...h-fe/node_modules/quill/dist/quill.jsModuleNotFoundError: Module not found: Error: Can't resolve 'css' in '/some_outer_path/some_path/workspace/work/project'
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/Compilation.js:232:38
    at onDoneResolving (/some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/NormalModuleFactory.js:40:20)
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/NormalModuleFactory.js:159:21
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:3853:9
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:484:16
    at iteratorCallback (/some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:1082:13)
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:988:16
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:3850:13
    at apply (/some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:41:25)
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:76:12
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:484:16
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:1161:9
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:484:16
    at iteratorCallback (/some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:1082:13)
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:988:16
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:1158:13
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/NormalModuleFactory.js:216:19
    at onResolved (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/Resolver.js:70:11)
    at loggingCallbackWrapper (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at afterInnerCallback (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/Resolver.js:138:10)
    at loggingCallbackWrapper (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at Resolver.applyPluginsAsyncSeriesBailResult1 (/some_outer_path/some_path/workspace/work/project/node_modules/tapable/lib/Tapable.js:108:46)
    at innerCallback (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/Resolver.js:125:19)
    at loggingCallbackWrapper (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at /some_outer_path/some_path/workspace/work/project/node_modules/tapable/lib/Tapable.js:210:15
    at /some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:39:4
    at loggingCallbackWrapper (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at afterInnerCallback (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/Resolver.js:138:10)
    at loggingCallbackWrapper (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at Resolver.applyPluginsAsyncSeriesBailResult1 (/some_outer_path/some_path/workspace/work/project/node_modules/tapable/lib/Tapable.js:108:46)
resolve 'css' in '/some_outer_path/some_path/workspace/work/project'
  Parsed request is a module
  using description file: /some_outer_path/some_path/workspace/work/project/package.json (relative path: .)
  after using description file: /some_outer_path/some_path/workspace/work/project/package.json (relative path: .)
    resolve as module
      /some_outer_path/some_path/workspace/work/node_modules doesn't exist or is not a directory
      /some_outer_path/some_path/workspace/node_modules doesn't exist or is not a directory
      /some_outer_path/some_path/node_modules doesn't exist or is not a directory
      /some_outer_path/node_modules doesn't exist or is not a directory
      /mnt/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /some_outer_path/some_path/workspace/work/project/node_modules
        using description file: /some_outer_path/some_path/workspace/work/project/package.json (relative path: ./node_modules)
        after using description file: /some_outer_path/some_path/workspace/work/project/package.json (relative path: ./node_modules)
          using description file: /some_outer_path/some_path/workspace/work/project/package.json (relative path: ./node_modules/css)
            as directory
              /some_outer_path/some_path/workspace/work/project/node_modules/css doesn't exist
            no extension
              /some_outer_path/some_path/workspace/work/project/node_modules/css doesn't exist
            .js
              /some_outer_path/some_path/workspace/work/project/node_modules/css.js doesn't exist
            .json
              /some_outer_path/some_path/workspace/work/project/node_modules/css.json doesn't exist

/some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/Compilation.js:197
                        _this.errors.push(err);
        ^
TypeError: Cannot read property 'errors' of null
    at errorAndCallback (/some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/Compilation.js:197:9)
    at errorOrWarningAndCallback (/some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/Compilation.js:228:13)
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/Compilation.js:232:12
    at onDoneResolving (/some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/NormalModuleFactory.js:40:20)
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/NormalModuleFactory.js:159:21
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:3853:9
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:484:16
    at iteratorCallback (/some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:1082:13)
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:988:16
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:3850:13
    at apply (/some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:41:25)
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:76:12
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:484:16
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:1161:9
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:484:16
    at iteratorCallback (/some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:1082:13)
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:988:16
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/node_modules/async/dist/async.js:1158:13
    at /some_outer_path/some_path/workspace/work/project/node_modules/webpack/lib/NormalModuleFactory.js:216:19
    at onResolved (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/Resolver.js:70:11)
    at loggingCallbackWrapper (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at afterInnerCallback (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/Resolver.js:138:10)
    at loggingCallbackWrapper (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at Resolver.applyPluginsAsyncSeriesBailResult1 (/some_outer_path/some_path/workspace/work/project/node_modules/tapable/lib/Tapable.js:108:46)
    at innerCallback (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/Resolver.js:125:19)
    at loggingCallbackWrapper (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at /some_outer_path/some_path/workspace/work/project/node_modules/tapable/lib/Tapable.js:210:15
    at /some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:39:4
    at loggingCallbackWrapper (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at afterInnerCallback (/some_outer_path/some_path/workspace/work/project/node_modules/enhanced-resolve/lib/Resolver.js:138:10)

npm ERR! Linux 4.4.0-45-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v6.8.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] /cdn-cgi/l/email-protection build: `rimraf dist && webpack --progress --profile --bail`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] /cdn-cgi/l/email-protection build script 'rimraf dist && webpack --progress --profile --bail'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the project package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     rimraf dist && webpack --progress --profile --bail
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs project
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls project
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /some_outer_path/some_path/workspace/work/project/npm-debug.log

webpack.config.js (主要来自这个种子 -https://github.com/preboot/angular2-webpack/ https://github.com/preboot/angular2-webpack/):

// Helper: root() is defined at the bottom
var path = require('path');
var webpack = require('webpack');

// Webpack Plugins
var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
var autoprefixer = require('autoprefixer');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var DashboardPlugin = require('webpack-dashboard/plugin');
var ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;

/**
 * Env
 * Get npm lifecycle event to identify the environment
 */
var ENV = process.env.npm_lifecycle_event;
var isTestWatch = ENV === 'test-watch';
var isTest = ENV === 'test' || isTestWatch;
var isProd = ENV === 'build';

module.exports = function makeWebpackConfig() {
  /**
   * Config
   * Reference: http://webpack.github.io/docs/configuration.html
   * This is the object where all configuration gets set
   */
  var config = {};

  /**
   * Devtool
   * Reference: http://webpack.github.io/docs/configuration.html#devtool
   * Type of sourcemap to use per build type
   */
  if (isProd) {
    config.devtool = 'source-map';
  }
  else if (isTest) {
    config.devtool = 'inline-source-map';
  }
  else {
    config.devtool = 'eval-source-map';
  }

  /**
   * Entry
   * Reference: http://webpack.github.io/docs/configuration.html#entry
   */
  config.entry = isTest ? {} : {
    'polyfills': './src/polyfills.ts',
    'vendor': './src/vendor.ts',
    'app': './src/main.ts' // our angular app
  };

  /**
   * Output
   * Reference: http://webpack.github.io/docs/configuration.html#output
   */
  config.output = isTest ? {} : {
    path: root('dist'),
    publicPath: isProd ? '/' : 'http://localhost:8080/',
    filename: isProd ? 'js/[name].[hash].js' : 'js/[name].js',
    chunkFilename: isProd ? '[id].[hash].chunk.js' : '[id].chunk.js'
  };

  /**
   * Resolve
   * Reference: http://webpack.github.io/docs/configuration.html#resolve
   */
  config.resolve = {
    // only discover files that have those extensions
    extensions: ['.ts', '.js', '.json', '.css', '.scss', '.html'],
  };

  var atlOptions = '';
  if (isTest && !isTestWatch) {
    // awesome-typescript-loader needs to output inlineSourceMap for code coverage to work with source maps.
    atlOptions = 'inlineSourceMap=true&sourceMap=false';
  }

  /**
   * Loaders
   * Reference: http://webpack.github.io/docs/configuration.html#module-loaders
   * List: http://webpack.github.io/docs/list-of-loaders.html
   * This handles most of the magic responsible for converting modules
   */
  config.module = {
    rules: [
      // Support for .ts files.
      {
        test: /\.ts$/,
        loaders: ['awesome-typescript-loader?' + atlOptions, 'angular2-template-loader', '@angularclass/hmr-loader'],
        exclude: [isTest ? /\.(e2e)\.ts$/ : /\.(spec|e2e)\.ts$/, /node_modules\/(?!(ng2-.+))/]
      },

      // copy those assets to output
      {
        test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: 'file?name=fonts/[name].[hash].[ext]?'
      },

      // Support for *.json files.
      {test: /\.json$/, loader: 'json'},

      // Support for CSS as raw text
      // use 'null' loader in test mode (https://github.com/webpack/null-loader)
      // all css in src/style will be bundled in an external css file
      {
        test: /\.css$/,
        exclude: root('src', 'app'),
        loader: isTest ? 'null' : ExtractTextPlugin.extract({
          fallbackLoader: 'style-loader',
          loader: ['css', 'postcss']
        })
      },
      // all css required in src/app files will be merged in js files
      {test: /\.css$/, include: root('src', 'app'), loader: 'raw!postcss'},

      // support for .scss files
      // use 'null' loader in test mode (https://github.com/webpack/null-loader)
      // all css in src/style will be bundled in an external css file
      {
        test: /\.(scss|sass)$/,
        exclude: root('src', 'app'),
        loader: isTest ? 'null' : ExtractTextPlugin.extract({
          fallbackLoader: 'style-loader',
          loader: ['css', 'postcss', 'sass']
        })
      },
      // all css required in src/app files will be merged in js files
      {test: /\.(scss|sass)$/, exclude: root('src', 'style'), loader: 'raw!postcss!sass'},

      // support for .html as raw text
      // todo: change the loader to something that adds a hash to images
      {test: /\.html$/, loader: 'raw', exclude: root('src', 'public')}
    ]
  };

  if (isTest && !isTestWatch) {
    // instrument only testing sources with Istanbul, covers ts files
    config.module.rules.push({
      test: /\.ts$/,
      enforce: 'post',
      include: path.resolve('src'),
      loader: 'istanbul-instrumenter-loader',
      exclude: [/\.spec\.ts$/, /\.e2e\.ts$/, /node_modules/]
    });
  }

  // if (!isTest || !isTestWatch) {
  //   // tslint support
  //   config.module.rules.push({
  //     test: /\.ts$/,
  //     enforce: 'pre',
  //     loader: 'tslint'
  //   });
  // }

  /**
   * Plugins
   * Reference: http://webpack.github.io/docs/configuration.html#plugins
   * List: http://webpack.github.io/docs/list-of-plugins.html
   */
  config.plugins = [
    // Define env variables to help with builds
    // Reference: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
    new webpack.DefinePlugin({
      // Environment helpers
      'process.env': {
        ENV: JSON.stringify(ENV)
      }
    }),

    // Workaround needed for angular 2 angular/angular#11580
    new webpack.ContextReplacementPlugin(
      // The (\\|\/) piece accounts for path separators in *nix and Windows
      /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
      root('./src') // location of your src
    ),

    // Tslint configuration for webpack 2
    new webpack.LoaderOptionsPlugin({
      options: {
        /**
         * Apply the tslint loader as pre/postLoader
         * Reference: https://github.com/wbuchwalter/tslint-loader
         */
        tslint: {
          emitErrors: false,
          failOnHint: false
        },
        /**
         * Sass
         * Reference: https://github.com/jtangelder/sass-loader
         * Transforms .scss files to .css
         */
        sassLoader: {
          //includePaths: [path.resolve(__dirname, "node_modules/foundation-sites/scss")]
        },
        /**
         * PostCSS
         * Reference: https://github.com/postcss/autoprefixer-core
         * Add vendor prefixes to your css
         */
        postcss: [
          autoprefixer({
            browsers: ['last 2 version']
          })
        ]
      }
    })

    // new webpack.ProvidePlugin({Quill: 'Quill'})
  ];

  if (!isTest && !isProd) {
    config.plugins.push(new DashboardPlugin());
  }

  if (!isTest && !isTestWatch) {
    config.plugins.push(
      new ForkCheckerPlugin(),

      // Generate common chunks if necessary
      // Reference: https://webpack.github.io/docs/code-splitting.html
      // Reference: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin
      new CommonsChunkPlugin({
        name: ['vendor', 'polyfills']
      }),

      // Inject script and link tags into html files
      // Reference: https://github.com/ampedandwired/html-webpack-plugin
      new HtmlWebpackPlugin({
        template: './src/public/index.html',
        chunksSortMode: 'dependency'
      }),

      // Extract css files
      // Reference: https://github.com/webpack/extract-text-webpack-plugin
      // Disabled when in test mode or not in build mode
      new ExtractTextPlugin({filename: 'css/[name].[hash].css', disable: !isProd})
    );
  }

  // Add build specific plugins
  if (isProd) {
    config.plugins.push(
      // Reference: http://webpack.github.io/docs/list-of-plugins.html#noerrorsplugin
      // Only emit files when there are no errors
      new webpack.NoErrorsPlugin(),

      // // Reference: http://webpack.github.io/docs/list-of-plugins.html#dedupeplugin
      // // Dedupe modules in the output
      // new webpack.optimize.DedupePlugin(),

      // Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
      // Minify all javascript, switch loaders to minimizing mode
      new webpack.optimize.UglifyJsPlugin({sourceMap: true, mangle: {keep_fnames: true}}),

      // Copy assets from the public folder
      // Reference: https://github.com/kevlened/copy-webpack-plugin
      new CopyWebpackPlugin([{
        from: root('src/public')
      }])
    );
  }

  /**
   * Dev server configuration
   * Reference: http://webpack.github.io/docs/configuration.html#devserver
   * Reference: http://webpack.github.io/docs/webpack-dev-server.html
   */
  config.devServer = {
    contentBase: './src/public',
    historyApiFallback: true,
    quiet: true,
    stats: 'minimal' // none (or false), errors-only, minimal, normal (or true) and verbose
  };

  return config;
}();

// Helper functions
function root(args) {
  args = Array.prototype.slice.call(arguments, 0);
  return path.join.apply(path, [__dirname].concat(args));
}

知道什么可能会损坏以及为什么吗?如何修复它?

Edit1: webpack version is 2.1.0-beta.25 2.1.0-beta.26 (Edit3)

Edit2:种子工作得不太好(只是为了清楚起见 - 一周前它也工作得很好)。它因以下错误而崩溃:

ERROR in ./src/polyfills.ts
Module build failed: TypeError: Can't add property fileName, object is not extensible
    at Object.Linter (/some_outer_path/some_path/workspace/work/angular2-webpack-official/node_modules/tslint/lib/tslint.js:12:23)

ERROR in ./src/vendor.ts
Module build failed: TypeError: Can't add property fileName, object is not extensible
    at Object.Linter (/some_outer_path/some_path/workspace/work/angular2-webpack-official/node_modules/tslint/lib/tslint.js:12:23)

ERROR in ./src/main.ts
Module build failed: TypeError: Can't add property fileName, object is not extensible
    at Object.Linter (/some_outer_path/some_path/workspace/work/angular2-webpack-official/node_modules/tslint/lib/tslint.js:12:23)

如果我在项目中允许 ts-lint,也会出现同样的错误。但我认为 ts-lint 只是因为错误的输入而崩溃(链中的其他东西早些时候破坏了它)。

我很确定我没有更改 Node 或 npm。我真的不知道。以下是项目依赖项:

  "dependencies": {
    "@angular/common": "2.1.0",
    "@angular/compiler": "2.1.0",
    "@angular/core": "2.1.0",
    "@angular/forms": "2.1.0",
    "@angular/http": "2.1.0",
    "@angular/platform-browser": "2.1.0",
    "@angular/platform-browser-dynamic": "2.1.0",
    "@angular/router": "3.1.0",
    "@ngrx/core": "^1.2.0",
    "@ngrx/effects": "^2.0.0",
    "@ngrx/router-store": "^1.2.5",
    "@ngrx/store": "^2.2.1",
    "@ngrx/store-devtools": "^3.2.1",
    "angular2-google-maps": "^0.15.0",
    "angular2-recaptcha": "^0.3.2",
    "core-js": "^2.4.1",
    "lodash": "^4.16.4",
    "ng2-translate": "^3.1.3",
    "primeng": "^1.0.0-rc.3",
    "quill": "^1.1.3",
    "ramda": "^0.22.1",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.12",
    "tsmonad": "^0.6.1",
    "zone.js": "^0.6.21"
  },
  "devDependencies": {
    "@angularclass/hmr": "^1.0.1",
    "@angularclass/hmr-loader": "^3.0.2",
    "@types/core-js": "^0.9.0",
    "@types/jasmine": "^2.2.29",
    "@types/node": "^6.0.38",
    "@types/protractor": "^1.5.16",
    "@types/selenium-webdriver": "2.44.26",
    "angular2-template-loader": "^0.4.0",
    "autoprefixer": "^6.3.2",
    "awesome-typescript-loader": "^2.2.4",
    "codelyzer": "0.0.26",
    "copy-webpack-plugin": "^3.0.0",
    "css-loader": "^0.25.0",
    "extract-text-webpack-plugin": "^2.0.0-beta.4",
    "file-loader": "^0.9.0",
    "html-loader": "^0.4.0",
    "html-webpack-plugin": "^2.8.1",
    "istanbul-instrumenter-loader": "^0.2.0",
    "jasmine-core": "^2.3.4",
    "jasmine-spec-reporter": "^2.4.0",
    "json-loader": "^0.5.3",
    "karma": "1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-coverage": "^1.0.0",
    "karma-jasmine": "^1.0.2",
    "karma-mocha-reporter": "^2.0.3",
    "karma-phantomjs-launcher": "^1.0.0",
    "karma-remap-istanbul": "0.2.1",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-webpack": "1.8.0",
    "node-sass": "^3.4.2",
    "null-loader": "0.1.1",
    "phantomjs-prebuilt": "^2.1.4",
    "postcss-loader": "^0.13.0",
    "protractor": "^3.1.1",
    "raw-loader": "0.5.1",
    "remap-istanbul": "^0.6.4",
    "rimraf": "^2.5.1",
    "sass-loader": "^4.0.0",
    "shelljs": "^0.7.0",
    "style-loader": "^0.13.0",
    "ts-helpers": "^1.1.1",
    "tslint": "^3.4.0",
    "tslint-loader": "^2.1.0",
    "typedoc": "^0.4.4",
    "typescript": "2.0.3",
    "url-loader": "^0.5.6",
    "webpack": "^2.1.0-beta.25",
    "webpack-dashboard": "^0.1.8",
    "webpack-dev-server": "2.1.0-beta.9"
  }

你确定你没有运行 beta26 吗?如果您在过去 8 小时内运行 npm install,您可能会获得新版本,其中包含加载器解析方式的重大更改

Run
./node_modules/.bin/webpack -v

对于 beta26 或更高版本,您需要将“-loader”附加到每个加载程序名称或添加“-loader”resolveLoader.moduleExtions

在你的情况下,我会将文件更改为文件加载器loader: 'file-loader?name=fonts/[name].[hash].[ext]?

您还可以通过在resolveLoader对象上显式指定moduleExtensions来选择旧方式

resolveLoader: {
    moduleExtensions: ['-loader']
}

我自己也遇到了类似的问题

Webpack v2.1.0-beta.26 发行说明 https://github.com/webpack/webpack/releases/tag/v2.1.0-beta.26

重大变化:

- 解析加载程序时不再自动添加加载程序

这已被删除,因为它经常会导致问题。

您仍然可以使用resolveLoader.moduleExtensions 配置选项选择旧行为。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Webpack突然崩溃了 的相关文章

  • 如何使用 TypeScript、Jest 和 Enzyme 测试 React 中的按钮点击

    我正在使用 TypeScript 构建一个 React Native 应用程序 我正在使用 Jest 和 Enzyme 进行组件测试 我也在使用 React 导航 我正在努力编写单击按钮的单元测试 这是组件的代码 只是渲染函数 render
  • 在 Angular 中深度复制对象

    AngularJS 有angular copy 深度复制对象和数组 Angular 也有类似的东西吗 您还可以使用 JSON parse JSON stringify Object 如果它在你的范围内 那么它就存在于每个 Angular 组
  • 用于传输命名参数和正文的云端点资源属性不起作用

    我正在尝试通过gapi client rpc调用实现对谷歌云端点的调用 如文档中所述 和Google Cloud Endpoints 使用 JS 客户端进行调用 传递参数和 JSON 正文 https stackoverflow com q
  • 三.js环境光意想不到的效果

    在下面的代码中 我渲染了一些立方体并使用点光源和环境光照亮它们 然而 当设置为 0xffffff 时 AmbientLight 会将侧面的颜色更改为白色 无论其指定的颜色如何 奇怪的是 点光源按预期工作 我怎样才能使环境光表现得像点光 因为
  • 如何在 Angular 2 应用程序中使 DateAdapter 单例?

    我正在开发一个带有延迟加载模块的 Angular 7 应用程序 我也使用有角度的材料组件 我想在日期选择器组件中本地化并支持多个区域设置 当应用程序语言发生变化时 我想在整个应用程序中全局更改它 可以通过 DateAdapter setLo
  • Browserify:如果需要,使用 module.exports,否则暴露全局

    我正在考虑采用浏览器化 http browserify org 对于我的一些项目 但想确保其他人如果想使用 捆绑的 代码就不必使用 browserify 执行此操作的明显方法是通过以下方式公开模块导出module exports以及通过一个
  • Intro.js 2页然后返回首页

    我在用intro js http introjs com 为我的网站创建一个小介绍 我希望游览从第 1 页 主页 2 另一页 然后回到第 1 页 主页 我已经成功地从第 1 2 页开始 但不确定如何让它返回到第 1 页 我对 javascr
  • Typescript 模块解析的根路径

    我有两个使用打字稿的项目 一个是核心项目 moduleA 另一个是业务项目 moduleB 项目B使用项目A的模块 ts文件 位于 scripts文件夹 我想通过以下方式为projectB指定模块解析根文件夹projectA scripts
  • 如何更改元素的 CSS 类并在单击时删除所有其他类

    我如何处理 AngularJS 2 中的一种情况 即单击一个元素需要更改其自己的样式 并且如果其他元素具有该样式 则需要将其删除 最好在一个函数中 如同Angular js 如何在单击时更改元素 css 类并删除所有其他元素 https s
  • JavaScript 中的最短路径

    几周来我一直在寻找一种在 JavaScript 中计算最短路径的方法 我一直在玩书数据结构和算法作者 格罗纳 Groner 名字恰如其分 https github com loiane javascript datastructs algo
  • 第二个函数参数的条件类型

    我有以下功能 function doSomething param1 string param2 string return param1 param2 我也有基于 json 的类型 其结构看起来与此类似 a1 b1 something1
  • 415 不支持的媒体类型; Angular2 到 API

    我是 Angular 2 的新手 我面临着一个无法找到解决方案的问题 当我尝试从 Angular 2 发布到 API 时 我得到 415 不支持的媒体类型 角度2代码 onSubmit value any console log value
  • Facebook API Javascript JSON 响应

    function getUser FB api me function response console log Response is response alert Your name is response first name ale
  • 如何显示 GroupList 的 FormArray?

    我正在尝试制作一个交互式表单 在每一行上列出一个项目以及一个删除按钮 在我的示例中称为 verwijderen 这些项目是从数据库中检索的 并且每个项目都实例化为名为的自定义对象LaborPeriod 然后这些对象被转化为FormGroup
  • 如何使用 Jquery .animate() 函数创建连续滚动内容? [复制]

    这个问题在这里已经有答案了 可能的重复 在jquery中实现圆形滚动条 https stackoverflow com questions 812049 implementing circular scroller in jquery 我想
  • 什么是 TinyMCE jQuery 包?

    我被要求在项目中使用 TinyMCE 编辑器 在下载页面上 有一个主包 然后是一个 jQuery 包 This package contains special jQuery build of TinyMCE and a jQuery in
  • JavaScript 正则表达式两个标签之间的多行文本

    我编写了一个正则表达式来从 HTML 中获取字符串 但似乎多行标志不起作用 这是我的模式 我想将文本输入h1 tag var pattern div class box content 5 h1 lt lt h1 gt mi m html
  • 如何调试 Node.js 应用程序?

    如何调试 Node js 服务器应用程序 现在我主要使用警报调试打印语句如下 sys puts sys inspect someVariable 一定有更好的调试方法 我知道谷歌浏览器 http en wikipedia org wiki
  • Javascript/jQuery 外部高度()

    Does idOfLememt outerHeight 对所有浏览器产生相同的结果 IE7 有什么不同吗 只要去http api jquery com outerHeight http api jquery com outerHeight
  • 我如何用 javascript/jquery 进行两指拖动?

    我正在尝试创建当有两个手指放在 div 上时拖动 div 的功能 我已将 div 绑定到 touchstart 和 touchmove 事件 我只是不确定如何编写这些函数 就像是if event originalEvent targetTo

随机推荐