在将new eject命令用于Webpack.config.js之后,没有渲染.html的url

时间:2018-06-12 13:06:03

标签: angular typescript webpack angular-cli

我用ng eject命令设置webpack.config.js中图像的选项 将大于10kb的图像加载到不同的文件夹。但是在弹出webpack配置文件之后,当我尝试使用.html加载任何url后缀,如http://localhost:4200/search.html时,它不会呈现页面并抛出异常 - 无法GET /search.html。所有其他不带.html后缀的网址都可以正常呈现。

定义的路线是

 RouterModule.forRoot([

  { path: 'operate_customer', component: HomeComponent },
  { path: 'contactus.html', component: ContactusComponent },
  { path: 'home',component: HomeComponent },
  { path: '', component: HomeComponent },
  { path: 'registration.html',component: RegistrationComponent },
  { path: 'login.html',component: LoginComponent },
  { path: 'wishlist.html',component: WishlistComponent },
  { path: 'sitemap.html',component: SitemapComponent },
  { path: 'cart.html',component: CartComponent },
  { path: 'checkout.html',component: CheckoutComponent },
  { path: 'search.html',component:SearchComponent },
  { path: 'collection/:slug', component: PagesnproductsComponent },
  { path: ':slug',component: PagesnproductsComponent },
  { path: ':slug/:name1',component: SubcategoryComponent },
  { path: ':slug/:name1/:name2',component: SubcategoryComponent },
  { path: ':slug/:name1/:name2/:name3',component: SubcategoryComponent }
]),

此外,我没有更改webpack配置,除了我上面提到的图像选项。 webpack配置脚本在下面提到了



const fs = require('fs');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const rxPaths = require('rxjs/_esm5/path-mapping');
const autoprefixer = require('autoprefixer');
const postcssUrl = require('postcss-url');
const cssnano = require('cssnano');
const customProperties = require('postcss-custom-properties');

const {
  NoEmitOnErrorsPlugin,
  SourceMapDevToolPlugin,
  NamedModulesPlugin
} = require('webpack');
const {
  ScriptsWebpackPlugin,
  NamedLazyChunksWebpackPlugin,
  BaseHrefWebpackPlugin
} = require('@angular/cli/plugins/webpack');
const {
  CommonsChunkPlugin
} = require('webpack').optimize;
const {
  AngularCompilerPlugin
} = require('@ngtools/webpack');

const nodeModules = path.join(process.cwd(), 'node_modules');
const realNodeModules = fs.realpathSync(nodeModules);
const genDirNodeModules = path.join(process.cwd(), 'src', '$$_gendir', 'node_modules');
const entryPoints = ["inline", "polyfills", "sw-register", "styles", "scripts", "vendor", "main"];
const minimizeCss = false;
const baseHref = "";
const deployUrl = "";
const projectRoot = "C:\\Users\\sit91\\Downloads\\angular_module";
const postcssPlugins = function() {
  // safe settings based on: https://github.com/ben-eb/cssnano/issues/358#issuecomment-283696193
  const importantCommentRe = /@preserve|@licen[cs]e|[@#]\s*source(?:Mapping)?URL|^!/i;
  const minimizeOptions = {
    autoprefixer: false,
    safe: true,
    mergeLonghand: false,
    discardComments: {
      remove: (comment) => !importantCommentRe.test(comment)
    }
  };
  return [
    postcssUrl({
      filter: ({
        url
      }) => url.startsWith('~'),
      url: ({
        url
      }) => path.join(projectRoot, 'node_modules', url.substr(1)),
    }),
    postcssUrl([{
        // Only convert root relative URLs, which CSS-Loader won't process into require().
        filter: ({
          url
        }) => url.startsWith('/') && !url.startsWith('//'),
        url: ({
          url
        }) => {
          if (deployUrl.match(/:\/\//) || deployUrl.startsWith('/')) {
            // If deployUrl is absolute or root relative, ignore baseHref & use deployUrl as is.
            return `${deployUrl.replace(/\/$/, '')}${url}`;
          } else if (baseHref.match(/:\/\//)) {
            // If baseHref contains a scheme, include it as is.
            return baseHref.replace(/\/$/, '') +
              `/${deployUrl}/${url}`.replace(/\/\/+/g, '/');
          } else {
            // Join together base-href, deploy-url and the original URL.
            // Also dedupe multiple slashes into single ones.
            return `/${baseHref}/${deployUrl}/${url}`.replace(/\/\/+/g, '/');
          }
        }
      },
      {
        // TODO: inline .cur if not supporting IE (use browserslist to check)
        filter: (asset) => !asset.hash && !asset.absolutePath.endsWith('.cur'),
        url: 'inline',
        // NOTE: maxSize is in KB
        maxSize: 10
      }
    ]),
    autoprefixer(),
    customProperties({
      preserve: true
    })
  ].concat(minimizeCss ? [cssnano(minimizeOptions)] : []);
};




module.exports = {
  "resolve": {
    "extensions": [
      ".ts",
      ".js"
    ],
    "modules": [
      "./node_modules",
      "./node_modules"
    ],
    "symlinks": true,
    "alias": rxPaths(),
    "mainFields": [
      "browser",
      "module",
      "main"
    ]
  },
  "resolveLoader": {
    "modules": [
      "./node_modules",
      "./node_modules"
    ],
    "alias": rxPaths()
  },
  "entry": {
    "main": [
      "./src\\main.ts"
    ],
    "polyfills": [
      "./src\\polyfills.ts"
    ],
    "styles": [
      "./src\\assets\\frontend\\css\\jquery-ui.css",
      "./src\\assets\\frontend\\css\\jquery-ui.theme.min.css",
      "./src\\styles.css",
      "./src\\assets\\frontend\\css\\language_selector.css",
      "./src\\assets\\frontend\\css\\theme.css",
      "./src\\assets\\frontend\\css\\style.css",
      "./src\\assets\\frontend\\css\\ajax.css",
      "./src\\assets\\frontend\\css\\style_custom.css",
      "./src\\assets\\frontend\\css\\ie.css",
      "./src\\assets\\frontend\\css\\super-panel.css",
      "./src\\assets\\frontend\\slick\\slick.css",
      "./src\\assets\\frontend\\slick\\slick-theme.css",
      "./src\\assets\\frontend\\css\\social_sharing.css",
      "./src\\assets\\frontend\\css\\Vresponsive.css",
      "./src\\assets\\dist\\css\\colorbox.css"
    ]
  },
  "output": {
    "path": path.join(process.cwd(), "dist"),
    "filename": "[name].bundle.js",
    "chunkFilename": "[id].chunk.js",
    "crossOriginLoading": false
  },
  "module": {
    "rules": [{
        "test": /\.html$/,
        "loader": "raw-loader"
      },
      {
        "test": /\.(eot|svg|cur)$/,
        "loader": "file-loader",
        "options": {
          "name": "[name].[hash:20].[ext]",
          "limit": 10000
        }
      },
      {
        "test": /\.(jpg|png|webp|gif|otf|ttf|woff|woff2|ani)$/,
        "loader": "url-loader",
        "options": {
          "name": 'images/[hash]-[name].[ext]',
          "limit": 10000
        }
      },
      {
        "exclude": [
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.theme.min.css"),
          path.join(process.cwd(), "src\\styles.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\language_selector.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ajax.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style_custom.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ie.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\super-panel.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick-theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\social_sharing.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\Vresponsive.css"),
          path.join(process.cwd(), "src\\assets\\dist\\css\\colorbox.css")
        ],
        "test": /\.css$/,
        "use": [
          "exports-loader?module.exports.toString()",
          {
            "loader": "css-loader",
            "options": {
              "sourceMap": false,
              "importLoaders": 1
            }
          },
          {
            "loader": "postcss-loader",
            "options": {
              "ident": "postcss",
              "plugins": postcssPlugins,
              "sourceMap": false
            }
          }
        ]
      },
      {
        "exclude": [
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.theme.min.css"),
          path.join(process.cwd(), "src\\styles.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\language_selector.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ajax.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style_custom.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ie.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\super-panel.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick-theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\social_sharing.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\Vresponsive.css"),
          path.join(process.cwd(), "src\\assets\\dist\\css\\colorbox.css")
        ],
        "test": /\.scss$|\.sass$/,
        "use": [
          "exports-loader?module.exports.toString()",
          {
            "loader": "css-loader",
            "options": {
              "sourceMap": false,
              "importLoaders": 1
            }
          },
          {
            "loader": "postcss-loader",
            "options": {
              "ident": "postcss",
              "plugins": postcssPlugins,
              "sourceMap": false
            }
          },
          {
            "loader": "sass-loader",
            "options": {
              "sourceMap": false,
              "precision": 8,
              "includePaths": []
            }
          }
        ]
      },
      {
        "exclude": [
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.theme.min.css"),
          path.join(process.cwd(), "src\\styles.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\language_selector.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ajax.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style_custom.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ie.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\super-panel.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick-theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\social_sharing.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\Vresponsive.css"),
          path.join(process.cwd(), "src\\assets\\dist\\css\\colorbox.css")
        ],
        "test": /\.less$/,
        "use": [
          "exports-loader?module.exports.toString()",
          {
            "loader": "css-loader",
            "options": {
              "sourceMap": false,
              "importLoaders": 1
            }
          },
          {
            "loader": "postcss-loader",
            "options": {
              "ident": "postcss",
              "plugins": postcssPlugins,
              "sourceMap": false
            }
          },
          {
            "loader": "less-loader",
            "options": {
              "sourceMap": false
            }
          }
        ]
      },
      {
        "exclude": [
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.theme.min.css"),
          path.join(process.cwd(), "src\\styles.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\language_selector.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ajax.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style_custom.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ie.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\super-panel.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick-theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\social_sharing.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\Vresponsive.css"),
          path.join(process.cwd(), "src\\assets\\dist\\css\\colorbox.css")
        ],
        "test": /\.styl$/,
        "use": [
          "exports-loader?module.exports.toString()",
          {
            "loader": "css-loader",
            "options": {
              "sourceMap": false,
              "importLoaders": 1
            }
          },
          {
            "loader": "postcss-loader",
            "options": {
              "ident": "postcss",
              "plugins": postcssPlugins,
              "sourceMap": false
            }
          },
          {
            "loader": "stylus-loader",
            "options": {
              "sourceMap": false,
              "paths": []
            }
          }
        ]
      },
      {
        "include": [
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.theme.min.css"),
          path.join(process.cwd(), "src\\styles.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\language_selector.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ajax.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style_custom.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ie.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\super-panel.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick-theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\social_sharing.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\Vresponsive.css"),
          path.join(process.cwd(), "src\\assets\\dist\\css\\colorbox.css")
        ],
        "test": /\.css$/,
        "use": [
          "style-loader",
          {
            "loader": "css-loader",
            "options": {
              "sourceMap": false,
              "importLoaders": 1
            }
          },
          {
            "loader": "postcss-loader",
            "options": {
              "ident": "postcss",
              "plugins": postcssPlugins,
              "sourceMap": false
            }
          }
        ]
      },
      {
        "include": [
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.theme.min.css"),
          path.join(process.cwd(), "src\\styles.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\language_selector.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ajax.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style_custom.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ie.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\super-panel.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick-theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\social_sharing.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\Vresponsive.css"),
          path.join(process.cwd(), "src\\assets\\dist\\css\\colorbox.css")
        ],
        "test": /\.scss$|\.sass$/,
        "use": [
          "style-loader",
          {
            "loader": "css-loader",
            "options": {
              "sourceMap": false,
              "importLoaders": 1
            }
          },
          {
            "loader": "postcss-loader",
            "options": {
              "ident": "postcss",
              "plugins": postcssPlugins,
              "sourceMap": false
            }
          },
          {
            "loader": "sass-loader",
            "options": {
              "sourceMap": false,
              "precision": 8,
              "includePaths": []
            }
          }
        ]
      },
      {
        "include": [
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.theme.min.css"),
          path.join(process.cwd(), "src\\styles.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\language_selector.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ajax.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style_custom.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ie.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\super-panel.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick-theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\social_sharing.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\Vresponsive.css"),
          path.join(process.cwd(), "src\\assets\\dist\\css\\colorbox.css")
        ],
        "test": /\.less$/,
        "use": [
          "style-loader",
          {
            "loader": "css-loader",
            "options": {
              "sourceMap": false,
              "importLoaders": 1
            }
          },
          {
            "loader": "postcss-loader",
            "options": {
              "ident": "postcss",
              "plugins": postcssPlugins,
              "sourceMap": false
            }
          },
          {
            "loader": "less-loader",
            "options": {
              "sourceMap": false
            }
          }
        ]
      },
      {
        "include": [
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\jquery-ui.theme.min.css"),
          path.join(process.cwd(), "src\\styles.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\language_selector.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ajax.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\style_custom.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\ie.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\super-panel.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\slick\\slick-theme.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\social_sharing.css"),
          path.join(process.cwd(), "src\\assets\\frontend\\css\\Vresponsive.css"),
          path.join(process.cwd(), "src\\assets\\dist\\css\\colorbox.css")
        ],
        "test": /\.styl$/,
        "use": [
          "style-loader",
          {
            "loader": "css-loader",
            "options": {
              "sourceMap": false,
              "importLoaders": 1
            }
          },
          {
            "loader": "postcss-loader",
            "options": {
              "ident": "postcss",
              "plugins": postcssPlugins,
              "sourceMap": false
            }
          },
          {
            "loader": "stylus-loader",
            "options": {
              "sourceMap": false,
              "paths": []
            }
          }
        ]
      },
      {
        "test": /\.ts$/,
        "loader": "@ngtools/webpack"
      }
    ]
  },
  "plugins": [
    new NoEmitOnErrorsPlugin(),
    new ScriptsWebpackPlugin({
      "name": "scripts",
      "sourceMap": true,
      "filename": "scripts.bundle.js",
      "scripts": [
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\frontend\\js\\jquery.min.js",
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\dist\\js\\jquery-ui.min.js",
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\frontend\\js\\common.js",
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\frontend\\js\\super-panel.js",
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\frontend\\js\\accordion-menu.js",
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\frontend\\js\\jquery.touchSwipe.js",
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\frontend\\js\\cc_c2a.min.js",
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\frontend\\js\\others.js",
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\frontend\\slick\\slick.js",
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\dist\\js\\jquery.colorbox-min.js",
        "C:\\Users\\sit91\\Downloads\\angular_module\\src\\assets\\dist\\js\\product.js"
      ],
      "basePath": "C:\\Users\\sit91\\Downloads\\angular_module"
    }),
    new CopyWebpackPlugin([{
        "context": "src",
        "to": "",
        "from": {
          "glob": "assets/**/*",
          "dot": true
        }
      },
      {
        "context": "src",
        "to": "",
        "from": {
          "glob": "template",
          "dot": true
        }
      },
      {
        "context": "src",
        "to": "",
        "from": {
          "glob": "favicon.ico",
          "dot": true
        }
      }
    ], {
      "ignore": [
        ".gitkeep",
        "**/.DS_Store",
        "**/Thumbs.db"
      ],
      "debug": "warning"
    }),
    new ProgressPlugin(),
    new CircularDependencyPlugin({
      "exclude": /(\\|\/)node_modules(\\|\/)/,
      "failOnError": false,
      "onDetected": false,
      "cwd": "C:\\Users\\sit91\\Downloads\\angular_module"
    }),
    new NamedLazyChunksWebpackPlugin(),
    new HtmlWebpackPlugin({
      "template": "./src\\index.html",
      "filename": "./index.html",
      "hash": false,
      "inject": true,
      "compile": true,
      "favicon": false,
      "minify": false,
      "cache": true,
      "showErrors": true,
      "chunks": "all",
      "excludeChunks": [],
      "title": "Webpack App",
      "xhtml": true,
      "chunksSortMode": function sort(left, right) {
        let leftIndex = entryPoints.indexOf(left.names[0]);
        let rightindex = entryPoints.indexOf(right.names[0]);
        if (leftIndex > rightindex) {
          return 1;
        } else if (leftIndex < rightindex) {
          return -1;
        } else {
          return 0;
        }
      }
    }),
    new BaseHrefWebpackPlugin({}),
    new CommonsChunkPlugin({
      "name": [
        "inline"
      ],
      "minChunks": null
    }),
    new CommonsChunkPlugin({
      "name": [
        "vendor"
      ],
      "minChunks": (module) => {
        return module.resource &&
          (module.resource.startsWith(nodeModules) ||
            module.resource.startsWith(genDirNodeModules) ||
            module.resource.startsWith(realNodeModules));
      },
      "chunks": [
        "main"
      ]
    }),
    new SourceMapDevToolPlugin({
      "filename": "[file].map[query]",
      "moduleFilenameTemplate": "[resource-path]",
      "fallbackModuleFilenameTemplate": "[resource-path]?[hash]",
      "sourceRoot": "webpack:///"
    }),
    new CommonsChunkPlugin({
      "name": [
        "main"
      ],
      "minChunks": 2,
      "async": "common"
    }),
    new NamedModulesPlugin({}),
    new AngularCompilerPlugin({
      "mainPath": "main.ts",
      "platform": 0,
      "hostReplacementPaths": {
        "environments\\environment.ts": "environments\\environment.ts"
      },
      "sourceMap": true,
      "tsConfigPath": "src\\tsconfig.app.json",
      "skipCodeGeneration": true,
      "compilerOptions": {}
    })
  ],
  "node": {
    "fs": "empty",
    "global": true,
    "crypto": "empty",
    "tls": "empty",
    "net": "empty",
    "process": true,
    "module": false,
    "clearImmediate": false,
    "setImmediate": false
  },
  "devServer": {
    "historyApiFallback": true
  }
};
&#13;
&#13;
&#13;

0 个答案:

没有答案