Giter VIP home page Giter VIP logo

ngc-webpack's Introduction

Build Status

ngc-webpack

@ngtools/webpack wrapper with hooks into the compilation process and library mode compilation support.

Application mode:

AOT compilation for an application.

Library mode:

AOT compilation for a library.

Library mode is the simple compile process we know from tsc / ngc where each module (TS file) is compiled into a matching JS file.

The output files can then bundle up with RollUp to create various bundle formats for published libraries (FESM, FESM2015, UMD, etc.)

This process is fairly simple as is but with the angular AOT compiler in the middle things are a bit more complex.

@ngtools/webpack does not support library compilation and it is (1.8.x) designed for application bundling only.

The @angular/compiler-cli does support library compilation through its ngc command line utility but it does not know about webpack, resources will not go through the loader chain and so using formats not supported by the angular cli will not work (SCSS, LESS etc).

Additionally, templareUrl and stylesUrls are left as is which is not suitable for libraries, resources must get inlined into the sources code (JS) and the AOT generated metadata.json files.

Webpack based projects:

ngc-webpack library mode allows AOT compilation for libraries through a CLI interface (ngc-w) or directly using it via node API with full support for inline and complete webpack loader chain compilation (for resources).

Angular CLI based projects:

ngc-webpack also support library compilation for @angular/cli projects by importing the configuration from the cli and using it to build libraries. This works great with monorepos and setup's based on nrwl's Nx. Also available by CLI interface (ngc-w-cli) or node API.

For more information see:

Library mode is experimental as it uses experimental API from angular packages.

Background:

ngc-webpack started as a wrapper for @angular/compiler-cli when angular build tools were limited.

It offered non @angular/cli users the ability to perform an AOT builds with all the required operations while still using a dedicated typescript loader (e.g. ts-loader, awesome-typescript-loader).

With version 5 of angular, the compiler-cli introduces a dramatic refactor in the compilation process, enabling watch mode for AOT and moving to a (almost) native TS compilation process using transformers.

The support angular 5, a complete rewrite for ngc-webpack was required. Since @ngtools/webpack is now a mature plugin with a rich feature set and core team support it is not smart (IMHO) to try and re-implement it.

This is why, from version 4 of ngc-webpack, the library will wrap @ngtools/webpack and only provide hooks into the compilation process.

The implications are:

  • Using ngc-webpack is safe, at any point you can move to @ngtools/webpack.
  • All features of @ngtools/webpack will work since ngc-webpack acts as a proxy. This includes i18n support which was not included in ngc-webpack 3.x.x
  • You can hack your way into the AOT compilation process, which opens a lot of options, especially for library compilation.
  • Using a custom typescript loader is no longer supported, you need to use the loader provided with @ngtools/webpack (for JIT see Using custom TypeScript loaders)

Using ngc-webpack as a proxy to @ngtools/webpack is safe and allows quick and transparent porting between the libraries.

In fact, if you use ngc-webpack without using it's extensibility features you probably better of using @ngtools/webpack directly instead.

When using ngc-webpack features, including library compilation mode, you should be aware that ngc-webpack is using experimental angular APIs as well as internal implementation of angular code to allow extensibility.

Usage:

npm install ngc-webpack -D

webpack.config.js

{
    module: {
        rules: [
            {
                test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
                use: [ '@ngtools/webpack' ]
            }
        ]
    },
    plugins: [
        new ngcWebpack.NgcWebpackPlugin({
          AOT: true,                            // alias for skipCodeGeneration: false
          tsConfigPath: './tsconfig.json',
          mainPath: 'src/main.ts'               // will auto-detect the root NgModule.
        })
    ]
}

Advanced AOT production builds:

Production builds must be AOT compiled, this is clear, but we can optimize the build even further, and the angular team has us covered using '@angular-devkit/build-optimizer:

webpack.config.js

const PurifyPlugin = require('@angular-devkit/build-optimizer').PurifyPlugin;

const AOT = true;

const tsLoader = {
    test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
    use: [ '@ngtools/webpack' ]
};

if (AOT) {
    tsLoader.use.unshift({
        loader: '@angular-devkit/build-optimizer/webpack-loader',
        // options: { sourceMap: true }
    });
}

return {
    module: {
        rules: [
            tsLoader
        ]
    },
    plugins: [
        new ngcWebpack.NgcWebpackPlugin({
          AOT,                            // alias for skipCodeGeneration: false
          tsConfigPath: './tsconfig.json',
          mainPath: 'src/main.ts'               // will auto-detect the root NgModule.
        }).concat(AOT ? [ new PurifyPlugin() ] : []),
    ]
}

The examples above are super simplified and describe the basic units for compilation, the @angular/cli uses them but with a lot more loaders/plugins/logic.

For more information about setting up the plugin see @ngtools/webpack

NgcWebpackPluginOptions:

The plugin accepts an options object of type NgcWebpackPluginOptions.

NgcWebpackPluginOptions extends AngularCompilerPluginOptions so all @ngtools/webpack options apply.

NgcWebpackPluginOptions adds the following options:

export interface NgcWebpackPluginOptions extends AngularCompilerPluginOptions {

  /**
   * An alias for `AngularCompilerPluginOptions.skipCodeGeneration` simply to make it more readable.
   * If `skipCodeGeneration` is set, this value is ignored.
   * If this value is not set, the default value is taken from `skipCodeGeneration`
   * (which means AOT = true)
   */
  AOT?: boolean;

  /**
   * A hook that invokes before the plugin start the compilation process (compiler 'run' event).
   * ( resourceCompiler: { get(filename: string): Promise<string> }) => Promise<void>;
   *
   * The hook accepts a resource compiler which able (using webpack) to perform compilation on
   * files using webpack's loader chain and return the final content.
   * @param resourceCompiler
   */
  beforeRun?: BeforeRunHandler

  /**
   * Transform a source file (ts, js, metadata.json, summery.json).
   * If `predicate` is true invokes `transform`
   *
   * > Run's in both AOT and JIT mode on all files, internal and external as well as resources.
   *
   *
   *  - Do not apply changes to resource files using this hook when in AOT mode, it will not commit.
   *  - Do not apply changes to resource files in watch mode.
   *
   * Note that source code transformation is sync, you can't return a promise (contrary to `resourcePathTransformer`).
   * This means that you can not use webpack compilation (or any other async process) to alter source code context.
   * If you know the files you need to transform, use the `beforeRun` hook.
   */
  readFileTransformer?: ReadFileTransformer;


  /**
   * Transform the path of a resource (html, css, etc)
   * (path: string) => string;
   *
   * > Run's in AOT mode only and on metadata resource files (templateUrl, styleUrls)
   */
  resourcePathTransformer?: ResourcePathTransformer;

  /**
   * Transform a resource (html, css etc)
   * (path: string, source: string) => string | Promise<string>;
   *
   * > Run's in AOT mode only and on metadata resource files (templateUrl, styleUrls)
   */
  resourceTransformer?: ResourceTransformer;

  /**
   * Add custom TypeScript transformers to the compilation process.
   *
   * Transformers are applied after the transforms added by `@angular/compiler-cli` and
   * `@ngtools/webpack`.
   *
   * > `after` transformers are currently not supported.
   */
  tsTransformers?: ts.CustomTransformers;
}

Optional Patching:

ngc-webpack comes with optional patches to angular, these are workarounds to existing issue that will probably get fixed in the future making the patch obsolete. Patch's address specific use case so make sure you apply them only if required.

disableExpressionLowering fix (@angular/compiler-cli):

The compiler-cli (version 5.0.1) comes with a new feature called lowering expressions which basically means we can now use arrow functions in decorator metadata (usually provider metadata)

This feature has bug the will throw when setting an arrow function:

export function MyPropDecorator(value: () => any) {
  return (target: Object, key: string) => {  }
}

export class MyClass {
  @MyPropDecorator(() => 15) // <- will throw because of this
  prop: string;
}

The compiler will lower the expression to:

export const ɵ0 = function () { return 15; };

but in the TS compilation process will fail because of a TS bug.

This is an edge case which you probably don't care about, but if so there are 2 options to workaround:

  1. Set disableExpressionLowering to false in tsconfig.json angularCompilerOptions
  2. Import a patch, at the top of your webpack config module:
 require('ngc-webpack/src/patch-angular-compiler-cli');

The issue should be fixed in next versions. See angular/angular#20216

Using custom TypeScript loaders

From ngc-webpack 4 using a custom ts loader is not supported for AOT compilation and partially supported for JIT.

If you must use your own TS Loader for JIT, you can do so. This is not recommended mainly because of the mis alignment between the compilations.

To use a custom loader (JIT only), remove the @ngtools/webpack loader and set your own loader. To support lazy loaded modules, use a module loader that can detect them (e.g. ng-router-loader)

Use case

The feature set within ngc-webpack is getting more and more specific. The target audience is small as most developers will not require hooking into the compilation.

It is mostly suitable for library builds, where you can control the metadata output, inline code and more...

I personally use it to restyle material from the ground. The plugin enables re-writing of the index.metadata.json files on the fly which allows sending custom styles to the compiler instead of the ones that comes with material.

Future

Because ngc-webpack becomes a niche, I believe integrating the hooks into @ngtools/webpack makes sense and then deprecating the library while easy porting to @ngtools/webpack. If someone would like to help working on it, please come forward :)

I believe it angular team is open to such idea since @ngtools/webpack is separated from the cli.

ngc-webpack's People

Contributors

dbettini avatar krakentyio avatar patrickjs avatar pglazkov avatar shlomiassaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ngc-webpack's Issues

Is it possible to inline html and styles in js files generated by ngc-w (not only the final bundled js)?

Hi @shlomiassaf ,

Thanks for this great project!

I'm publishing a angular library, with components with external *.html templates and *.scss styles, referenced via templateUrl and stylesUrls :

templateUrl './my-html',
stylesUrls: ['/.my-style.scss']

With webpack, I'm able to successfully generate a UMD js bundle of the library, that contains everything inlined (template and styles).

I would like to achieve the same with the js files generated by ngc-w (via ngc), because i am also releasing them as part of my library (along with the *.d.ts, *.metadata.json, and *.js.map for AoT compatibility) .

Is it possible to achieve that with your library, coupled with webpack?

Here are the relevant part of my configuration:

webpack.config.js

//Config
module.exports = {
  devtool: 'source-map',
  entry: helpers.root('src/index.ts'),

  resolve: {
    modules: [
      'node_modules',
      helpers.root('src')
    ],
    extensions: ['.ts', '.js']
  },

  context: helpers.root('src'),

  module: {
    loaders: [
      {
        test: /\.ts$/,
        use: [
          {
            loader: 'awesome-typescript-loader',
            query: {
              configFileName: helpers.root('tsconfig-aot.json')
            }
          },
          'angular2-template-loader'
        ],
        exclude: [/\.(spec|e2e)\.ts$/]
      },
      {
        test: /\.html$/,
        use: ['raw-loader']
      },
      {
        test: /\.css$/,
        use: ['raw-loader', 'css-loader?importLoaders=1', 'postcss-loader']
      },
      {
        test: /\.(scss|sass)$/,
        exclude: helpers.root('src', 'scss'),
        use: ['raw-loader', 'css-loader?importLoaders=1', 'postcss-loader', 'sass-loader']
      }
    ]
  },
 output: {
    path: helpers.root('dist/bundles'),
    filename: 'my-library.umd.js',
    library: 'my-library',
    libraryTarget: 'umd',
    umdNamedDefine: true
  },

  plugins: [
    new NgcWebpack.NgcWebpackPlugin({
      disabled: false,
      tsConfig: helpers.root('tsconfig-aot.json'),
      resourceOverride: helpers.root('config/resource-override.js')
    }),
    new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
      beautify: false,
      mangle: {
        screw_ie8: true,
        keep_fnames: true
      },
      compress: {
        warnings: false,
        screw_ie8: true
      },
      comments: false,
      sourceMap: true
    })
  ]
}

tsconfig.json ( AoT compatible)*

{
    "compilerOptions": {
        "target": "es5",
        "module": "es6",
        "lib": [
            "es6",
            "dom"
        ],
        "moduleResolution": "node",
        "declaration": true,
        "experimentalDecorators": true,
        "baseUrl": ".",
        "stripInternal": true,
        "outDir": "./dist",
        "rootDir": "./src",
        "sourceMap": true,
        "inlineSources": true,
        "skipLibCheck": true,
        "typeRoots": [
            "node_modules/@types"
        ]
    },
    "files": [
        "./src/index.ts"
    ],
    "exclude": [
        "node_modules",
        "dist",
        "demo",
        "config",
        "coverage",
        "src/**/*.spec.ts"
    ],
    "angularCompilerOptions": {
        "strictMetadataEmit": true,
        "genDir": "./dist/ngfactories"
    }
}

I'm using
"ngc-webpack": "1.1.0" ( i'm limited to angular 2.3.1)
"typescript": "2.0.2",
"webpack": "2.2.0"

Thanks in advance!

Plugin doesn't work with angular 5.0.0-rc.0

Seems angular team changed @angular/compiler-cli API since 5.0.0-rc.0.

TypeError: compiler_cli_1.NgcCliOptions is not a constructor
    at /home/travis/build/shakrmedia/frontend/node_modules/ngc-webpack/src/plugin.js:54:76
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:667:11)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:607:3

AOT build with angular i18n

We are currently trying to get our AOT build to work with i18n.
The Angular i18n docs (https://angular.io/guide/i18n) say ngc needs some arguments to make AOT include translation files:
./node_modules/.bin/ngc --i18nFile=./locale/messages.es.xlf --locale=es --i18nFormat=xlf

We found that NgcWebpackPlugin has an option called cliOptions that gets transformed to a instance of NgcCliOptions. So we tried to configure NgcWebpackPlugin in our webpack config as follows:

   new ngcWebpack.NgcWebpackPlugin({
        disabled: !AOT,
        tsConfig: helpers.root('tsconfig.webpack.json'),
        resourceOverride: helpers.root('config/resource-override.js'),
        cliOptions: {
            i18nFormat: 'xtb',
            i18nFile: './i18n/messages.en.xtb',
            locale: 'en',
        }
      })

But nothing happens... no error but also no translations. Are we missing something? Is anything wrong with options object? We couldn't find any examples out there. Or is there anything else we need to do or include to get translations compiled into the AOT build?

Watch mode simply doesn't work with 3.x?

I'm using an old version because your old compiler seems to be the only thing that works with the crazy thing I'm doing.

Watch mode simply isn't possible with old AOT? I keep getting loops no matter what I do.

Even if that's off the table, does anyone know a way to use webpack-dev-server without watch mode?

//dev server options
watchOptions: {
    watch: false,
}

Doesn't seem to do anything

Lint only

Hey guys,
Aot is slow and not suitable for development in watch mode for our app.
While it get better, we had the idea to search if we could use the Aot compiler as a lint only, as it reports advanced issues including html references.

So, is it possible?
Thanks

Angular 7 ngc-webpack

hi,i am migrating my angular 4 admin project to 7 ,and after migration getting this error.The project was working fine with version4.

Cannot read property 'prototype' of undefined
at __extends (/var/www/html/ifta_7/admin/node_modules/ngc-webpack/src/webpack-chain-module-resolution-host-adapter.js:5:69)
at /var/www/html/ifta_7/admin/node_modules/src/webpack-chain-module-resolution-host-adapter.ts:7:62
at Object. (/var/www/html/ifta_7/admin/node_modules/src/webpack-chain-module-resolution-host-adapter.ts:7:1)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/var/www/html/ifta_7/admin/node_modules/src/main.ts:15:1)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/var/www/html/ifta_7/admin/node_modules/src/plugin.ts:3:1)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
devDependancy:{
"webpack": "2.3.3",
"webpack-dev-middleware": "1.10.1",
"webpack-dev-server": "2.4.2",
"webpack-dll-bundles-plugin": "1.0.0-beta.5",
"webpack-merge": "4.1.0",
}

"ngc-webpack": "^1.2.0"
I have tried to upgrade version of ngc-webpack to 4.But then getting error @ngtools/webpack not found

Missing assets

I am playing with AoT and noticed that when using ngc-webpack some assets aren't created.
Please check this commit. After it if I try to build project using @ngtools/webpack(config) I am getting:

sergey@computer ~/projects/aot_test $ ./node_modules/.bin/webpack --config webpack.config.aot.js 
Hash: 567cbe8c3537b60c2f38
Version: webpack 3.4.1
Time: 4461ms
            Asset       Size  Chunks                    Chunk Names
bundle.avatar.png     2.1 kB          [emitted]         
    0../bundle.js    7.35 kB       0  [emitted]         
      ./bundle.js    1.31 MB       1  [emitted]  [big]  main
       bundle.css  126 bytes       1  [emitted]         main
...

and with ngc-webpack(config):

sergey@computer ~/projects/aot_test $ ./node_modules/.bin/webpack --config webpack.config.ngc.js 
...
Hash: e959e901fa742c70e34a
Version: webpack 3.4.1
Time: 7831ms
        Asset       Size  Chunks                    Chunk Names
0../bundle.js    5.54 kB       0  [emitted]         
  ./bundle.js    1.31 MB       1  [emitted]  [big]  main
   bundle.css  126 bytes       1  [emitted]         main
...

There is no bundle.avatar.png(it is referenced in the template of lazy loaded component). Do I miss something or this is a bug?

Then I tried to reference more assets in styles in next commit. And some of them also got ignored:

sergey@computer ~/projects/aot_test $ ./node_modules/.bin/webpack --config webpack.config.aot.js 
Hash: fb31cc0ecb14a4e48d3e
Version: webpack 3.4.1
Time: 4691ms
               Asset       Size  Chunks                    Chunk Names
   bundle.avatar.png     2.1 kB          [emitted]         
bundle.check-off.png    2.89 kB          [emitted]         
   bundle.on-off.png    4.62 kB          [emitted]         
 bundle.check-on.png    2.84 kB          [emitted]         
       0../bundle.js     7.4 kB       0  [emitted]         
         ./bundle.js    1.31 MB       1  [emitted]  [big]  main
          bundle.css  182 bytes       1  [emitted]         main
...
sergey@computer ~/projects/aot_test $ ./node_modules/.bin/webpack --config webpack.config.ngc.js 
...
Hash: 7078a94d761ee584ea50
Version: webpack 3.4.1
Time: 8622ms
              Asset       Size  Chunks                    Chunk Names
bundle.check-on.png    2.84 kB          [emitted]         
      0../bundle.js    5.59 kB       0  [emitted]         
        ./bundle.js    1.31 MB       1  [emitted]  [big]  main
         bundle.css  182 bytes       1  [emitted]         main
...

Code for v3?

I have an issue with v3 of ngc-webpack and wanted to make a pull request. Now I can't find the code for v3 anywhere in this repo. The v3 npm package links to this repo and I can't find any other similar repo neither on google nor on github. Would you mind to push the code here or post a link to the new repo?

ngc-webpack with `webpack.config.ts` does not work well

Problem

When I build my project with webpack.config.ts which imports ngc-webpack, I got the following error:

          throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
                ^
TSError: ⨯ Unable to compile TypeScript
config\helpers.ts (10,25): Parameter 'flag' implicitly has an 'any' type. (7006)

Of course config/helpers.ts is fully typed and the project had built successfully before I have updated dependencies.

Investigation

I realized that ts-node should be loaded only once. (source: TypeStrong/ts-node#333 (comment))

So my project register ts-node twice...

breaks webpack-dll-bundles-plugin

Using this plugin breaks your webpack-dll-bundles-plugin.

If DLLs already exist prior to enabling ngc-webpack plugin, and then I enable ngc-webpack, it is success

Starting compilation using the angular compiler.
Angular compilation done, starting webpack bundling.
DLL: Checking if DLLs are valid.
DLL: All DLLs are valid.

However If I delete my dlls folder, then try to run again, fail

Starting compilation using the angular compiler.
Angular compilation done, starting webpack bundling.
Error: ENOENT: no such file or directory, open 'C:\Source\GitHub\wwwroot\dlls\polyfills-manifest.json'

It tries to look for the manifest file before even checking if the DLLs are valid or not.

v1.2.0 still gives error with resourceOverride option set

I saw your discussion here: PatrickJS/PatrickJS-starter#1406 and updated to 1.2.0.

I still get this error:

ERROR in ./~/css-loader!./~/postcss-loader!./~/sass-loader/lib/loader.js!./config/resource-override.js
Module build failed: No input specified: provide a file name or a source string to process
 @ ./src/app/moneyback-guarantee/moneyback-guarantee.style.scss 2:21-180
 @ ./src/app/moneyback-guarantee/moneyback-guarantee.component.ts
 @ ./compiled/src/app/app.module.ngfactory.ts
 @ ./src/main.browser.aot.ts

when I comment out the resourceOverride option in my webpack config, the error goes away.

     new ngcWebpack.NgcWebpackPlugin({
        disabled: !AOT,
        tsConfig: helpers.root('tsconfig.webpack.json')/*,
        resourceOverride: helpers.root('config/resource-override.js')*/
      })

In the .scss file mentioned in error, the only poignant things I have are:

@import "../shared/config";

(which contains a bunch of variable declarations), and:

.moneyback-text__bottom__button {
  height: 3.5em;
  width: 3.5em;
  border: none;
  outline: none;
  background: transparent url('/assets/img/next-button.png');
  background-size: contain;
}

Change log docs?

I think this repo missing a documentation for changes, you maybe need to create a release with changes or a separated file as CHANGELOG.md, it is always confusing when I come here to use this module, I have no idea about changes, and what the breaking changes and versions.

Error "callback(): The callback was already called" when building with the new cleanup loader

After I added the ngc-webpack loader I get the following error during AOT build:

Error: callback(): The callback was already called.                                                       
   at context.callback (<project_path>\node_modules\loader-runner\lib\LoaderRunner.js:106:10)                                
   at Object.aotCleanLoader (<project_path>\node_modules\src\aot-clean-transformer\loader\text-based-loader\loader.ts:283:9) 
   at Object.aotCleanLoader (<project_path>\node_modules\src\aot-clean-transformer\loader\index.ts:16:31)                    
   at LOADER_EXECUTION (<project_path>\node_modules\loader-runner\lib\LoaderRunner.js:119:14)                                
   at runSyncOrAsync (<project_path>\node_modules\loader-runner\lib\LoaderRunner.js:120:4)                                   
   at iterateNormalLoaders (<project_path>\node_modules\loader-runner\lib\LoaderRunner.js:229:2)                             
   at iterateNormalLoaders (<project_path>\node_modules\loader-runner\lib\LoaderRunner.js:218:10)                            
   at <project_path>\node_modules\loader-runner\lib\LoaderRunner.js:233:3                                                    
   at Object.context.callback (<project_path>\node_modules\loader-runner\lib\LoaderRunner.js:111:13)                         
   at Object.module.exports (<project_path>\node_modules\angular2-template-loader\index.js:56:10)                            
   at LOADER_EXECUTION (<project_path>\node_modules\loader-runner\lib\LoaderRunner.js:119:14)                                
   at runSyncOrAsync (<project_path>\node_modules\loader-runner\lib\LoaderRunner.js:120:4)                                   
   at iterateNormalLoaders (<project_path>\node_modules\loader-runner\lib\LoaderRunner.js:229:2)                             
   at Array.<anonymous> (<project_path>\node_modules\loader-runner\lib\LoaderRunner.js:202:4)                                
   at Storage.finished (<project_path>\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:40:15)
   at <project_path>\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:77:9                    
   at <project_path>\node_modules\graceful-fs\graceful-fs.js:78:16                                                           
   at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)                                                                                   

Loader typescript chain in AOT ?

We use an internal loader to remove dev code for produciton build (like console.log and internal logger) applied to typescript files :

// webpack.prod.js
...
{
    enforce : 'pre',
    test : /\.ts$/,
    loaders : ['internal-replace-loader'],
    exclude : [/\.(spec|e2e)\.ts$/]
},
...
{
    test : /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
    use : ['@angular-devkit/build-optimizer/webpack-loader', '@ngtools/webpack']
},
...

In JIT , build loader chain works fine, but in AOT this loader is call but code remplacement is not applied to the output build.

Do you have an idea ?
Thanks

Angular 5.0.0.rc6

I am getting this error with this version of angular:

webpack-chain-module-resolution-host-adapter.js:7
extendStatics(d, b);
TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf ()
at __extends (..\node_modules\ngc-webpack\src\webpack-chain-module-resolution-host-adapter.js:7:9)
at ..\node_modules\src\webpack-chain-module-resolution-host-adapter.ts:7:62
at Object. (..\node_modules\src\webpack-chain-module-resolution-host-adapter.ts:7:1)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object. (..\node_modules\src\main.ts:14:1)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object. (C..\node_modules\src\plugin.ts:3:1)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)

Garbage files are created in project root

For each *.ts file a set of garbage files is created nearby, starting from project root:

*.js,*.js.map,*.ngsummary.json,*.ngfactory.js,*.ngfactory.js.map

*.ngsummary.json,*.ngfactory.js,*.ngfactory.js.map are duplicated in genDir (<project-root>/aot/), *.js,*.js.map are not.

This does not happen when the project is being built without ngc-webpack and AoT with the same configuration (just awesome-typescript-loader and JiT).

The setup is loosely based on https://github.com/AngularClass/angular2-webpack-starter and is quite ordinary, here are the most relevant details:

package.json

  ...
  "devDependencies": {
    "@angular/compiler-cli": "^4.0.2",
    "ngc-webpack": "^2.0.0",
    "awesome-typescript-loader": "^3.0.0",
    "typescript": "~2.2.0",
    "webpack": "~2.4.1",
    ...
  },
  ...

webpack.config.js

module.exports = {
	entry: {
		'polyfills': './src/polyfills.ts',
		'main': process.env.AOT
			? './src/main.aot.ts'
			: './src/main.jit.ts'
	},

	resolve: {
		extensions: ['.ts', '.js', '.json'],
		modules: [
			path.join(ROOT, 'src'),
			NODE_MODULES
		]
	},

	module: {
		loaders: [
			{
				test: /\.ts$/,
				loaders: [
					{
						loader: 'awesome-typescript-loader',
						options: { configFileName: 'tsconfig.json' }
					}
				],
				exclude: [/\.(spec|e2e)\.ts$/]
			},
			{
				test: /\.json$/,
				loader: 'json-loader'
			},
			...
		]
	},

	plugins: [
		new CommonsChunkPlugin({ name: ['polyfills'] }),
		new CheckerPlugin,
		new ngcWebpack.NgcWebpackPlugin({
			disabled: !process.env.AOT,
			tsConfig: path.join(ROOT, 'tsconfig.json'),
			resourceOverride: path.join(ROOT_PATH, 'aot-empty-resource.js')
		})
	],

	node: {
		global: true,
		crypto: 'empty',
		process: true,
		module: false,
		clearImmediate: false,
		setImmediate: false
	}
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "alwaysStrict": true,
    "sourceMap": true,
    "noEmitHelpers": true,
    "importHelpers": true,
    "strictNullChecks": false,
    "baseUrl": "./src",
    "paths": [],
    "lib": [
      "dom",
      "es5"
    ],
    "types": [...],
    "typeRoots": ["./node_modules/@types"]
  },
  "exclude": [
    "node_modules",
    "dist"
  ],
  "compileOnSave": false,
  "buildOnSave": false
}

css image not generated after upgrading from 1.2.0 to 2.0.0

I have style that includes this:

background-image: url(~assets/images/header_background.png);

When using ngc-webpack 1.2.0, an image is generated during aot build. After upgrading to 2.0.0, the image is no longer generated. Do I need to change some settings?

The build is done on a linux box.

Missing tsickle depedency

Version: 4.1.2

In util.ts, tsickle is being imported, but is not included in the package.json. Is this expected?

JavaScript heap out of memory is thrown

We can build only a bare minimum of the application with AOT, when building the whole app with AOT we get out of memory problems.

32599ms additional asset processing
92% chunk asset optimization
<--- Last few GCs --->

166208 ms: Mark-sweep 1320.6 (1436.5) -> 1319.8 (1436.5) MB, 1396.1 / 0.0 ms [allocation failure] [GC in old space requested].
167613 ms: Mark-sweep 1319.8 (1436.5) -> 1319.8 (1436.5) MB, 1404.8 / 0.0 ms [allocation failure] [GC in old space requested].
169076 ms: Mark-sweep 1319.8 (1436.5) -> 1326.0 (1420.5) MB, 1462.3 / 0.0 ms [last resort gc].
170586 ms: Mark-sweep 1326.0 (1420.5) -> 1332.4 (1420.5) MB, 1509.0 / 0.0 ms [last resort gc].

Loader chain doesn't run in `require` and results in `Expected 'styles' to be an array of strings`

Loader chain itself works fine, and const style = require('./foo-bar.scss') results in a string, the problem looks like compilation precedes loader chain when require is used.

Having styleUrls for component styles works well with ngc-webpack:

@Component({
  selector: 'foo-bar',
  styleUrls: './foo-bar.scss',
   ...

But it cannot be easily used in JIT.

And having require for component styles like

@Component({
  selector: 'foo-bar',
  styles: [require('./foo-bar.scss')],
   ...

results in Webpack error:

Angular compilation done, starting webpack bundling.
Error: Expected 'styles' to be an array of strings.
    at assertArrayOfStrings (<project-root>\node_modules\@angular\compiler\@angular\compiler.es5.js:3356:12)
    at CompileMetadataResolver.getNonNormalizedDirectiveMetadata (<project-root>\node_modules\@angular\compiler\bundles\compiler.umd.js:13785:13)
    at CompileMetadataResolver._loadDirectiveMetadata (<project-root>\node_modules\@angular\compiler\@angular\compiler.es5.js:13698:17)
    at <project-root>\node_modules\@angular\compiler\@angular\compiler.es5.js:13922:54
    ...

Debugging assertArrayOfStrings showed that styles: [require('./foo-bar.scss')] is evaluated in compiler to styles: [null], no matter how style loaders are configured. It can be styles: [require('raw-loader!foo-bar.html')] or styles: [require('non-existing-loader!non-existing-file')], the result is the same. Loaders just aren't considered at the moment when compiler runs.

The setup is loosely based on https://github.com/AngularClass/angular2-webpack-starter and is quite ordinary, here are the most relevant details:

package.json

  ...
  "devDependencies": {
    "@angular/compiler-cli": "^4.0.2",
    "ngc-webpack": "^2.0.0",
    "awesome-typescript-loader": "^3.0.0",
    "typescript": "~2.2.0",
    "webpack": "~2.4.1",
    "css-loader": "^0.25.0",
    "node-sass": "^4.5.2",
    "raw-loader": "^0.5.1",
    "sass-loader": "^6.0.3",
    "to-string-loader": "^1.1.4",
    ...
  },
  ...

webpack.config.js

module.exports = {
	entry: {
		'polyfills': './src/polyfills.ts',
		'main': process.env.AOT
			? './src/main.aot.ts'
			: './src/main.jit.ts'
	},

	resolve: {
		extensions: ['.ts', '.js', '.json'],
		modules: [
			path.join(ROOT, 'src'),
			NODE_MODULES
		]
	},

	module: {
		loaders: [
			{
				test: /\.ts$/,
				loaders: [
					{
						loader: 'awesome-typescript-loader',
						options: { configFileName: 'tsconfig.json' }
					}
				],
				exclude: [/\.(spec|e2e)\.ts$/]
			},
			{
				test: /\.json$/,
				loader: 'json-loader'
			},
			{
				test: /\.css$/,
				loaders: ['to-string-loader', 'css-loader']
			},
			{
				test: /\.scss$/,
				loader: [
					'raw-loader',
					{
						loader: 'sass-loader',
						options: { includePaths: [NODE_MODULES }
					}
				]
			},
			{
				test: /\.html$/,
				loader: 'html-loader',
				exclude: []
			}
		]
	},

	plugins: [
		new CommonsChunkPlugin({ name: ['polyfills'] }),
		new CheckerPlugin,
		new ngcWebpack.NgcWebpackPlugin({
			disabled: !process.env.AOT,
			tsConfig: path.join(ROOT, 'tsconfig.json'),
			resourceOverride: path.join(ROOT_PATH, 'aot-empty-resource.js')
		})
	],

	node: {
		global: true,
		crypto: 'empty',
		process: true,
		module: false,
		clearImmediate: false,
		setImmediate: false
	}
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "alwaysStrict": true,
    "sourceMap": true,
    "noEmitHelpers": true,
    "importHelpers": true,
    "strictNullChecks": false,
    "baseUrl": "./src",
    "paths": [],
    "lib": [
      "dom",
      "es5"
    ],
    "types": [...],
    "typeRoots": ["./node_modules/@types"]
  },
  "exclude": [
    "node_modules",
    "dist"
  ],
  "compileOnSave": false,
  "buildOnSave": false
}

Build fails in gitlab ci

I have a build that works in circle ci on docker image circleci/node:7.10 and custom docker image with node:8.1.2 but fails on gitlab ci on the same images. This is the error

Starting compilation using the angular compiler. Angular compilation done, starting webpack bundling. Error: Child compilation failed: Module parse failed: /builds/team-birowsky/cscade-frontend/app/src/components/app/app.html Unexpected token (1:0) You may need an appropriate loader to handle this file type. | <csc-header | [mainMenuIsOpened]="mainMenuIsOpenedSubj.asObservable().distinctUntilChanged() | async" | [userMenuIsOpened]="userMenuIsOpenedSubj.asObservable().distinctUntilChanged() | async": SyntaxError: Unexpected token (1:0) at /builds/team-birowsky/cscade-frontend/node_modules/ngc-webpack/src/webpack-resource-loader.js:51:28 at Compiler.<anonymous> (/builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compiler.js:291:10) at /builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compiler.js:494:13 at next (/builds/team-birowsky/cscade-frontend/node_modules/tapable/lib/Tapable.js:184:11) at Compiler.<anonymous> (/builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/CachePlugin.js:62:5) at Compiler.applyPluginsAsyncSeries (/builds/team-birowsky/cscade-frontend/node_modules/tapable/lib/Tapable.js:188:13) at /builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compiler.js:491:10 at Compilation.applyPluginsAsyncSeries (/builds/team-birowsky/cscade-frontend/node_modules/tapable/lib/Tapable.js:177:46) at self.applyPluginsAsync.err (/builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compilation.js:645:19) at Compilation.applyPluginsAsyncSeries (/builds/team-birowsky/cscade-frontend/node_modules/tapable/lib/Tapable.js:177:46) at self.applyPluginsAsync.err (/builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compilation.js:636:11) at next (/builds/team-birowsky/cscade-frontend/node_modules/tapable/lib/Tapable.js:184:11) at Compilation.compilation.plugin (/builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/optimize/UglifyJsPlugin.js:230:5) at Compilation.applyPluginsAsyncSeries (/builds/team-birowsky/cscade-frontend/node_modules/tapable/lib/Tapable.js:188:13) at self.applyPluginsAsync.err (/builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compilation.js:631:10) at Compilation.applyPluginsAsyncSeries (/builds/team-birowsky/cscade-frontend/node_modules/tapable/lib/Tapable.js:177:46) at sealPart2 (/builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compilation.js:627:9) at Compilation.applyPluginsAsyncSeries (/builds/team-birowsky/cscade-frontend/node_modules/tapable/lib/Tapable.js:177:46) at Compilation.seal (/builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compilation.js:575:8) at /builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compiler.js:488:16 at /builds/team-birowsky/cscade-frontend/node_modules/tapable/lib/Tapable.js:271:11 at _addModuleChain (/builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compilation.js:477:11) at processModuleDependencies.err (/builds/team-birowsky/cscade-frontend/node_modules/webpack/lib/Compilation.js:448:13) at _combinedTickCallback (internal/process/next_tick.js:95:7) at process._tickCallback (internal/process/next_tick.js:161:9)

I don't see why it should not work on gitlab ci because the docker images are the same. Maybe some enviorment variables make a problem?

Support for multiple entry points?

Hello there. I'd like to know is it possible to make it work for multiple entry points? My app is structured of three packages, one is a node server and the other two are angular client apps. Those two are linked dependencies of the server, which bundles them. This is my configuration:

const tsClientNames = ["studio", "learn"];
tsClientNames.forEach(name => webpackConfig.module.rules.push({
    test: /\.tsx?$/,
    include: path.join(require.resolve(`${name}-client`), ".."),
    use: [
        {
            loader: "awesome-typescript-loader",
            options: {
                configFileName: path.join(require.resolve(`${name}-client`),"../tsconfig.json")
            }
        },
        "angular-router-loader",
        "angular2-template-loader"
    ]
}));

As you can see, both of them have their own tsconfig, libraries, types etc. It all works well in JIT, since I scoped the loaders through the 'include' property, so there are no conflicts. @ngtools/webpack does not support this, but since this lib is calling ngc after passing the loader chain, it seems possible, maybe by using separate ngc instances?

js, .d.ts and metadata file not generated

I am creating the library using angular 5. I use the ngc-webpack 4.1.2 . When i run the aot build, I dont see the individual metadata, .js, .d.ts files generated to the outDir. I would like my dist folder to be AOT and JIT compatible.

Here is the tsconfg file.

"angularCompilerOptions": {
"genDir": "./compiled",
"strictMetadataEmit": true,
"skipTemplateCodegen": true
},
"compilerOptions": {
"moduleResolution": "node",
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outDir": "./dist/lib",
"rootDir": "./src/lib",
"lib": [ "es2015", "dom" ],
"target": "es5",
"types": ["node"],
"module": "es2015",
"sourceMap": true,
"stripInternal": true
},
"files": [
"./src/lib/index.ts"
],

This is how i call the plugin in webpack configuration.
{
test: /(?:.ngfactory.js|.ngstyle.js|.ts)$/,
use: [ '@ngtools/webpack' ]
},

new ngcWebpack.NgcWebpackPlugin({
AOT: true, // alias for skipCodeGeneration: false
tsConfigPath: 'tsconfig.ngc.json',
sourceMap: true
}),

4.1.0 missing ngc-webpack/src/cli.js

Hi after upgrade version to 4.1.0 from npm, it return this error (4.0.2 work great):

npm ERR! path /home/~/project/node_modules/ngc-webpack/src/cli.js 
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/home/~/project/node_modules/ngc-webpack/src/cli.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

Angular 5 Issue

Im working on a legacy project, just updated it from Angular 4.x to 5 and im running into this error which im unsure of, any ideas

[nodemon] starting `ts-node server.ts`

/Applications/MAMP/htdocs/username/Development/legacy-app/node_modules/ngc-webpack/src/webpack-chain-module-resolution-host-adapter.js:7
        extendStatics(d, b);
        ^
TypeError: Object prototype may only be an Object or null: undefined
    at setPrototypeOf (<anonymous>)
    at __extends (/Applications/MAMP/htdocs/username/Development/legacy-app/node_modules/ngc-webpack/src/webpack-chain-module-resolution-host-adapter.js:7:9)
    at /Applications/MAMP/htdocs/username/Development/legacy-app/node_modules/src/webpack-chain-module-resolution-host-adapter.ts:7:62
    at Object.<anonymous> (/Applications/MAMP/htdocs/username/Development/legacy-app/node_modules/src/webpack-chain-module-resolution-host-adapter.ts:7:1)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Applications/MAMP/htdocs/username/Development/legacy-app/node_modules/src/main.ts:14:1)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
[nodemon] app crashed - waiting for file changes before starting...

loaderUtils.getOptions is not a function

After adding ngc-webpack loader in config file:

{ loader: 'ngc-webpack', options: { disable: !AOT, } },

When start in momery or build as prod, the following error occur:

`
ERROR in ./src/main.browser.ts
Module build failed: TypeError: loaderUtils.getOptions is not a function
at Object.aotCleanLoader (~/node_modules/src/aot-clean-transformer/loader/loader.ts:225:60)
@ multi (webpack)-dev-server/client?http://0.0.0.0:8888 ./src/main.browser.ts

ERROR in ./src/polyfills.browser.ts
Module build failed: TypeError: loaderUtils.getOptions is not a function
at Object.aotCleanLoader (~/node_modules/src/aot-clean-transformer/loader/loader.ts:225:60)
@ multi (webpack)-dev-server/client?http://0.0.0.0:8888 ./src/polyfills.browser.ts

`

build calls:
"start": "npm run server:dev",
"build:aot:prod": "npm run clean:dist && npm run clean:aot && cross-env BUILD_AOT=1 npm run webpack -- --config config/webpack.prod.js --progress --profile --bail",

using

"ngc-webpack": "~3.1.0",

"@types/webpack": "^3.0.5",
"add-asset-html-webpack-plugin": "^2.0.1",
"assets-webpack-plugin": "^3.5.1",
"copy-webpack-plugin": "^4.0.1",
"extract-text-webpack-plugin": "~3.0.0",
"html-webpack-plugin": "^2.30.0",
"inline-manifest-webpack-plugin": "^3.0.1",
"karma-webpack": "^2.0.4",
"preload-webpack-plugin": "^1.2.3",
"script-ext-html-webpack-plugin": "^1.8.5",

"webpack": "~3.4.1",
"webpack-dev-middleware": "^1.11.0",
"webpack-dev-server": "~2.6.1",
"webpack-dll-bundles-plugin": "^1.0.0-beta.5",
"webpack-merge": "~4.1.0"

Add missing any to parameter in plugin.d.ts

beforeResolve(result: any, callback: (err: Error | null, result) => void): void;
afterResolve(result: any, callback: (err: Error | null, result) => void): void;

missing type any for result parameter for callback function. This results in errors when using "noImplicitAny": true for TypeScript compiler.

Cannot set property 'disable' of undefined (tsconfig inheritance)

It seems that tsconfigs with inheritance are not correctly processed.

If config looks like

{
    "extends": "./tsconfig",
    "angularCompilerOptions": {
        "genDir": "./compiled",
        "skipMetadataEmit": true
    }
}

an error occurs at text-based-loader/loader.ts because there is no compilerOptions.

Module build failed: TypeError: Cannot set property 'disable' of undefined

See https://github.com/shlomiassaf/ngc-webpack/blob/master/src/aot-clean-transformer/loader/text-based-loader/loader.ts#L269

For now I add empty compilerOptions as a workaround:

{
    "extends": "./tsconfig",
    "compilerOptions": {},
    "angularCompilerOptions": {
        "genDir": "./compiled",
        "skipMetadataEmit": true
    }
}

ngc-webpack Aot

I have an issue with ngc-webpack

I use https://github.com/AngularClass/angular-starter starter that use ngc-webpack

for example add dependency to devextreme in one module (for example BarrelModule)

import { DxDataGridModule } from 'devextreme-angular';
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

and import DxDataGridModule int module
in bothe prod and aot build the size of js file is same (4.5 M)

But if i use AotPlugin the size of js file is about 2M in aot build

whats the problem?

tanx

Unexpected closing tag "a".

Hello. I just tried to setup this library, but getting weird errors:

{ Error: Template parse errors:
Unexpected closing tag "a". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags ("ass=icon-bar></span> <span class=icon-bar></span> </button> <a class=navbar-brand routerlink=/ >Home[ERROR ->]</a> </div> <div class="collapse navbar-collapse" id=header-navbar [collapse]=collapsed> <ul class="n"): ng:///angular/app/layouts/header/header.layout.html@0:353
}

However, template is fine:

    <div class='navbar-header'>
      <button aria-expanded='false' class='navbar-toggle collapsed' (click)='collapsed = !collapsed' type='button'>
        <span class='icon-bar'></span>
        <span class='icon-bar'></span>
        <span class='icon-bar'></span>
      </button>

      <a class='navbar-brand' routerLink='/'>Home</a>
    </div>

If I change a to be like this <a class='navbar-brand' [routerLink]='"/"'>Home</a> it works. But later on I'm getting more similar errors.

@ngtools/webpack

I take it this is basically a temporary replacement solution for AotPlugin, right? Now, do people at @angular/angular-cli know of the problems people encounter using AotPlugin, or in other words, are there issues open for the problems this plugin solves?

Basically I very much agree with..

In the future I hope we all converge into 1 solution, @ngtools/webpack

..and while this plugin is a great replacement, I would love to be able to a) track the issues so I know when it's safe to switch b) make sure that @angular/angular-cli members are aware of the problems..

ngc version 3 work with webpack 4

Is there any chance of getting ngc updated to use webpack 4? We still use NGC v3.2.2 because we use Angular in a multi page app with multiple entry points defined in webpack,
I tried using ngc-webpack with webpack 4 and while JIT dev mode is working, when i turn on AOT mode, webpack complains gives a tapable plugin error (i believe the api hoooks changed and ngc-webpack would have to be updated)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.