当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript webpack.compilation.warnings类代码示例

本文整理汇总了TypeScript中webpack.compilation.warnings的典型用法代码示例。如果您正苦于以下问题:TypeScript compilation.warnings类的具体用法?TypeScript compilation.warnings怎么用?TypeScript compilation.warnings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了compilation.warnings类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: Error

            .then((output: any) => {
              let hasWarnings = false;
              if (output.warnings && output.warnings.length > 0) {
                compilation.warnings.push(...output.warnings);
                hasWarnings = true;
              }

              if (output.errors && output.errors.length > 0) {
                output.errors
                  .forEach((error: string) => compilation.errors.push(new Error(error)));
                return;
              }

              // generally means invalid syntax so bail
              if (hasWarnings && output.stats.minifiedSize === 0) {
                return;
              }

              let newSource;
              if (output.sourceMap) {
                newSource = new SourceMapSource(
                  output.styles,
                  file,
                  output.sourceMap.toString(),
                  content,
                  map,
                );
              } else {
                newSource = new RawSource(output.styles);
              }

              compilation.assets[file] = newSource;
            });
开发者ID:cexbrayat,项目名称:angular-cli,代码行数:33,代码来源:cleancss-webpack-plugin.ts

示例2: purifyReplacements

    compiler.plugin('compilation', (compilation: compilation.Compilation) => {
      // Webpack 4 provides the same functionality as this plugin and TS transformer
      compilation.warnings.push('PurifyPlugin is deprecated and will be removed in 0.7.0.');

      compilation.plugin('optimize-chunk-assets', (chunks: Chunk[], callback: () => void) => {
        chunks.forEach((chunk: Chunk) => {
          chunk.files
            .filter((fileName: string) => fileName.endsWith('.js'))
            .forEach((fileName: string) => {
              const inserts = purifyReplacements(compilation.assets[fileName].source());

              if (inserts.length > 0) {
                const replaceSource = new ReplaceSource(compilation.assets[fileName], fileName);
                inserts.forEach((insert) => {
                  replaceSource.insert(insert.pos, insert.content);
                });
                compilation.assets[fileName] = replaceSource;
              }
            });
        });
        callback();
      });
    });
开发者ID:fmalcher,项目名称:angular-cli,代码行数:23,代码来源:webpack-plugin.ts


注:本文中的webpack.compilation.warnings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。