MS Edge没有找到webpack文件

时间:2018-03-06 09:27:53

标签: webpack microsoft-edge

我正在开发一个大型应用程序,它有一个只出现在MS EDGE上的小错误,试图期待实际发生的事情,在控制台中,我得到的信息是它没有找到

  

的WebPack:///(的WebPack)-dev-服务器/客户端

这是我在package.json文件中的脚本命令:

"scripts": {
  "test": "mocha-webpack --colors --require ./src/client/testHelpers/setup.jsx --webpack-config webpack/webpack.test.js \"src/client/app/**/*.spec.jsx\"",
  "test:watch": "mocha-webpack --colors --require ./src/client/testHelpers/setup.jsx  --webpack-config webpack/webpack.test.watch.js --watch \"src/client/app/**/*.spec.jsx\"",
  "test:coverage": "cross-env nyc mocha-webpack --colors  --webpack-config webpack/webpack.test.coverage.js  \"src/client/app/*/**/*.jsx\"",
  "dev": "cross-env NODE_ENV=development node webpack/webpack.dev.server.js --config webpack/webpack.dev.js",
  "build": "cross-env NODE_ENV=production webpack --progress --colors --config webpack/webpack.prod.js",
  "postinstall": "yarn run build && yarn test && yarn run less:lint",
  "less:lint": "lesshint --max-warnings 0 --reporter ./_scripts/lesshint-reporter.js src/client/app -e *Source-Sans*.less",
  "doc": "react-asciidoc-generator ./src/client/app/ -o ../../docs/generated/react.adoc --handlebar-template src/docs/asciidoc-template.handlebars "
},

这是webpack.dev.js文件:

"use strict";

const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const AutoDllPlugin = require('autodll-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
const merge = require('webpack-merge');
const commonDevAndProd = require('./webpack.common.dev_and_prod.js');
const pkg = require('./../package.json');

const extractVendor = new ExtractTextPlugin("vendor-style.css");

const CORE_DIR = path.resolve(__dirname, '../node_modules');
const ROOT_DIR = path.resolve(__dirname, '../src/client');
const APP_DIR = path.resolve(ROOT_DIR, 'app');

const config = {
  devtool: 'inline-source-map',

  entry: [
   'babel-polyfill',
   'react-hot-loader/patch',
   'webpack-dev-server/client?http://localhost:9000',
   'webpack/hot/only-dev-server',
    APP_DIR + '/index.jsx',
  ],

  output: {
     filename: 'bundle.js',
    path: ROOT_DIR,
    publicPath: "/",
  },

  plugins: [
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: path.join(ROOT_DIR, 'index.html'),
    }),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NamedModulesPlugin(),
    new AutoDllPlugin({
      context: path.join(__dirname, '..'),
      inject: true,
      filename: '[name].js',
      entry: {
        vendor: Object.keys(pkg.dependencies).filter(dep => dep !== 'babel-runtime'),
      },
      plugins: [
        extractVendor,
      ],
      inherit: () => ({
        module: {
          rules: [
            {
              test: /\.(less|css)?$/,
              use: extractVendor.extract({
                fallback: 'style-loader',
                use: [
                  {
                    loader: 'css-loader',
                  }, {
                    loader: 'less-loader',
                    options: {
                      modifyVars: {
                        nodeModulesPath: '~',
                        coreModulePath: '~',
                      },
                    },
                  },
                ],
                publicPath: './',
              }),
              include: [CORE_DIR],
            },
          ]
        }
      }),
    }),
  ],

  devServer: {
    historyApiFallback: true,
  },
};

module.exports = merge(commonDevAndProd, config);

0 个答案:

没有答案