How to use the @ngtools/webpack.PLATFORM.Browser function in @ngtools/webpack

To help you get started, we’ve selected a few @ngtools/webpack examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / angular-cli / packages / angular_devkit / build_angular / src / angular-cli-files / models / webpack-configs / typescript.ts View on Github external
export function getTypescriptWorkerPlugin(wco: WebpackConfigOptions, workerTsConfigPath: string) {
  const { buildOptions } = wco;

  let pluginOptions: AngularCompilerPluginOptions = {
    skipCodeGeneration: true,
    tsConfigPath: workerTsConfigPath,
    mainPath: undefined,
    platform: PLATFORM.Browser,
    sourceMap: buildOptions.sourceMap.scripts,
    forkTypeChecker: buildOptions.forkTypeChecker,
    contextElementDependencyConstructor: require('webpack/lib/dependencies/ContextElementDependency'),
    logger: wco.logger,
    // Run no transformers.
    platformTransformers: [],
    // Don't attempt lazy route discovery.
    discoverLazyRoutes: false,
  };

  pluginOptions = _pluginOptionsOverrides(buildOptions, pluginOptions);

  return new AngularCompilerPlugin(pluginOptions);
}
github vladimiry / ElectronMail / webpack / web.ts View on Github external
],
                        },
                    ],
                },
                resolve: {
                    alias: {
                        images: rootRelativePath("images"),
                    },
                },
                plugins: [
                    new AngularCompilerPlugin({
                        entryModule: `${browserWindowAppPath("./app.module")}#AppModule`,
                        additionalLazyModules: {
                            ["./_db-view/db-view.module#DbViewModule"]: browserWindowAppPath("./_db-view/db-view.module.ts"),
                        },
                        platform: PLATFORM.Browser,
                        skipCodeGeneration: !aot,
                        tsConfigPath: tsConfigFile,
                        compilerOptions: readConfiguration(tsConfigFile).options,
                        nameLazyFiles: true,
                        contextElementDependencyConstructor: require("webpack/lib/dependencies/ContextElementDependency"),
                        discoverLazyRoutes: true, // TODO disable "discoverLazyRoutes" once switched to Ivy renderer
                        directTemplateLoading: false,
                    }),
                ],
                optimization: {
                    splitChunks: {
                        cacheGroups: {
                            commons: {
                                test: /[\\/]node_modules[\\/]|[\\/]vendor[\\/]/,
                                name: "vendor",
                                chunks: "all",
github vladimiry / ElectronMail / webpack-configs / web / browser-window.ts View on Github external
new DefinePlugin({
                BUILD_ANGULAR_COMPILATION_FLAGS: JSON.stringify(angularCompilationFlags),
            }),
            new AngularCompilerPlugin({
                contextElementDependencyConstructor: require("webpack/lib/dependencies/ContextElementDependency"),
                tsConfigPath: tsConfigFile,
                compilerOptions: {
                    preserveWhitespaces: false,
                    disableTypeScriptVersionCheck: true,
                    strictInjectionParameters: true,
                    fullTemplateTypeCheck: angularCompilationFlags.aot || angularCompilationFlags.ivy,
                    ivyTemplateTypeCheck: angularCompilationFlags.ivy,
                    enableIvy: angularCompilationFlags.ivy,
                    ...readConfiguration(tsConfigFile).options,
                },
                platform: PLATFORM.Browser,
                skipCodeGeneration: !angularCompilationFlags.aot,
                nameLazyFiles: true,
                discoverLazyRoutes: true, // TODO disable "discoverLazyRoutes" once switched to Ivy renderer
                directTemplateLoading: false,
                entryModule: `${browserWindowAppPath("./app.module")}#AppModule`,
                additionalLazyModules: {
                    ["./_db-view/db-view.module#DbViewModule"]: browserWindowAppPath("./_db-view/db-view.module.ts"),
                },
            }),
        ],
        optimization: {
            splitChunks: {
                cacheGroups: {
                    commons: {
                        test: /[\\/]node_modules[\\/]|[\\/]vendor[\\/]/,
                        name: "vendor",
github vladimiry / ElectronMail / src / web / webpack.config.js View on Github external
isDevEnv: metadata.env.isDevelopment(),
                    isProdEnv: metadata.env.isProduction(),
                    isHrm: hrmEnabled,
                },
            }),
            new webpack.EnvironmentPlugin({
                NODE_ENV_RUNTIME: metadata.env.value,
            }),
            new CircularDependencyPlugin({
                exclude: /([\\\/])node_modules([\\\/])/,
                failOnError: true,
            }),
            new AngularCompilerPlugin({
                // compilerOptions: {},
                entryModule: `${path.join(metadata.paths.src, "app/app.module")}#AppModule`,
                platform: PLATFORM.Browser,
                skipCodeGeneration: !aotEnabled,
                tsConfigPath: metadata.paths.tsConfig,
            }),
        ],
    },

    development: {
        mode: "development",
        devServer: {
            port: metadata.devPort,
            host: metadata.devHost,
            hot: hrmEnabled,
            inline: true,
            stats: "minimal",
            clientLogLevel: "error",
        },