angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.73k stars 11.98k forks source link

update @ngtools/webpack issuse #5607

Closed keyiis closed 7 years ago

keyiis commented 7 years ago

Versions.

nodejs 6.9.2 os win10x 64

Repro steps.

when i update @ngtools/webpack from 1.2.8 to 1.2.14,webpack build no error output,but nothing generate.i never change any config file before update.

The log given by the failure.

no error output

Desired functionality.

i want generate bundle js file

Mention any other details that might be useful.

webpack.aot.config.js

var webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
var webpackMerge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var commonConfig = require('./webpack.common.js');
var helpers = require('./helpers');
const AotPlugin = require('@ngtools/webpack').AotPlugin;

const ENV = process.env.NODE_ENV = process.env.ENV = 'production';

module.exports = webpackMerge(commonConfig, {
  entry: {
    'app': helpers.rootAngular('app/main.ts')
  },
  output: {
    path: helpers.outputBuild(),
    filename: '[name].[hash].bundle.js',
    chunkFilename: '[id].[chunkhash].chunk.js'
  },

  module: {
    loaders: [
      { test: /\.ts$/, loaders: ['@ngtools/webpack'] },
      {
        test: /\.css$/,
        exclude: helpers.rootAngular('app'),
        loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: 'css-loader' })
      },
    ]
  },
  plugins: [
    // new OptimizeJsPlugin({
    //   sourceMap: false
    // }),
    new AotPlugin({
        tsConfigPath: helpers.root('tsconfig.aot.json'),
        entryModule: helpers.rootAngular('app/app.module#AppModule')
    }),
    new webpack.NoEmitOnErrorsPlugin(),
    new webpack.optimize.UglifyJsPlugin({
            beautify: false,
            mangle: {
                screw_ie8: true,
                keep_fnames: true
            },
            compress: {
                warnings: false,
                screw_ie8: true
            },
            comments: false
    }),
    new HtmlWebpackPlugin({
      template: helpers.rootAngular('index.html'),
      minify:{
        removeComments:true,
        collapseWhitespace: true
      }
    }),
    new ExtractTextPlugin('[name].[hash].css'),
    new webpack.DefinePlugin({
      'process.env': {
        'ENV': JSON.stringify(ENV)
      }
    })
  ]
});
keyiis commented 7 years ago

I back to 1.2.8, all work fine,so 1.2.14 has bug? or has new config method?or dependence other module?

jruef commented 7 years ago

Same problem here. When we upgrade from 1.2.3 to 1.2.14 and then running in aot mode does not work. Same problem on 1.3.0. It seems that the modules for lazy loading are not generated properly. The error we got is (products is one of our modules that we lazy load):

EXCEPTION: Uncaught (in promise): Error: Cannot find module './products/products.module.ngfactory'.
Error: Cannot find module './products/products.module.ngfactory'.
    at webpackEmptyContext (http://localhost:9003/js/app.js:46913:8) [angular]
    at SystemJsNgModuleLoader.loadFactory (http://localhost:9003/js/app.js:47017:40) [angular]
    at SystemJsNgModuleLoader.load (http://localhost:9003/js/app.js:46989:35) [angular]
    at RouterConfigLoader.loadModuleFactory (http://localhost:9003/js/app.js:17837:128) [angular]
    at RouterConfigLoader.load (http://localhost:9003/js/app.js:17824:81) [angular]
    at MergeMapSubscriber.project (http://localhost:9003/js/app.js:70592:111) [angular]
    at MergeMapSubscriber._tryNext (http://localhost:9003/js/vendor.js:1669:27) [angular]
    at MergeMapSubscriber._next (http://localhost:9003/js/vendor.js:1659:18) [angular]
    at MergeMapSubscriber.Subscriber.next (http://localhost:9003/js/vendor.js:230:18) [angular]
    at ScalarObservable._subscribe (http://localhost:9003/js/vendor.js:2899:24) [angular]
    at ScalarObservable.Observable.subscribe (http://localhost:9003/js/vendor.js:51:27) [angular]
    at MergeMapOperator.call (http://localhost:9003/js/vendor.js:1634:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MergeMapOperator.call (http://localhost:9003/js/vendor.js:1634:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at CatchOperator.call (http://localhost:9003/js/vendor.js:2945:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at Object.subscribeToResult (http://localhost:9003/js/vendor.js:457:27) [angular]
    at MergeAllSubscriber._next (http://localhost:9003/js/vendor.js:1517:42) [angular]
    at MergeAllSubscriber.Subscriber.next (http://localhost:9003/js/vendor.js:230:18) [angular]
    at MapSubscriber._next (http://localhost:9003/js/vendor.js:1388:26) [angular]
    at MapSubscriber.Subscriber.next (http://localhost:9003/js/vendor.js:230:18) [angular]
    at ArrayObservable._subscribe (http://localhost:9003/js/vendor.js:1096:28) [angular]
    at ArrayObservable.Observable.subscribe (http://localhost:9003/js/vendor.js:51:27) [angular]
    at MapOperator.call (http://localhost:9003/js/vendor.js:1359:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MergeAllOperator.call (http://localhost:9003/js/vendor.js:1495:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at FirstOperator.call (http://localhost:9003/js/vendor.js:3661:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at CatchOperator.call (http://localhost:9003/js/vendor.js:2945:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MapOperator.call (http://localhost:9003/js/vendor.js:1359:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at Object.subscribeToResult (http://localhost:9003/js/vendor.js:457:27) [angular]
    at MergeAllSubscriber._next (http://localhost:9003/js/vendor.js:1517:42) [angular]
    at MergeAllSubscriber.Subscriber.next (http://localhost:9003/js/vendor.js:230:18) [angular]
    at ScalarObservable._subscribe (http://localhost:9003/js/vendor.js:2899:24) [angular]
    at ScalarObservable.Observable.subscribe (http://localhost:9003/js/vendor.js:51:27) [angular]
    at MergeAllOperator.call (http://localhost:9003/js/vendor.js:1495:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at LastOperator.call (http://localhost:9003/js/vendor.js:5713:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MapOperator.call (http://localhost:9003/js/vendor.js:1359:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MapOperator.call (http://localhost:9003/js/vendor.js:1359:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MapOperator.call (http://localhost:9003/js/vendor.js:1359:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at CatchOperator.call (http://localhost:9003/js/vendor.js:2945:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at Object.subscribeToResult (http://localhost:9003/js/vendor.js:457:27) [angular]
    at CatchSubscriber.error (http://localhost:9003/js/vendor.js:2975:33) [angular]
    at MapSubscriber.Subscriber._error (http://localhost:9003/js/vendor.js:269:26) [angular]
    at MapSubscriber.Subscriber.error (http://localhost:9003/js/vendor.js:243:18) [angular]
    at CatchSubscriber.error (http://localhost:9003/js/vendor.js:2970:34) [angular]
    at FirstSubscriber.Subscriber._error (http://localhost:9003/js/vendor.js:269:26) [angular]
    at FirstSubscriber.Subscriber.error (http://localhost:9003/js/vendor.js:243:18) [angular]
    at MergeAllSubscriber.OuterSubscriber.notifyError (http://localhost:9003/js/vendor.js:421:26) [angular]
    at InnerSubscriber._error (http://localhost:9003/js/vendor.js:11489:21) [angular]
    at InnerSubscriber.Subscriber.error (http://localhost:9003/js/vendor.js:243:18) [angular]
    at CatchSubscriber.error (http://localhost:9003/js/vendor.js:2970:34) [angular]
    at Observable._subscribe (http://localhost:9003/js/app.js:70273:104) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:51:27) [angular]
    at CatchOperator.call (http://localhost:9003/js/vendor.js:2945:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at Object.subscribeToResult (http://localhost:9003/js/vendor.js:457:27) [angular]
    at MergeAllSubscriber._next (http://localhost:9003/js/vendor.js:1517:42) [angular]
    at MergeAllSubscriber.Subscriber.next (http://localhost:9003/js/vendor.js:230:18) [angular]
    at MapSubscriber._next (http://localhost:9003/js/vendor.js:1388:26) [angular]
    at MapSubscriber.Subscriber.next (http://localhost:9003/js/vendor.js:230:18) [angular]
    at ArrayObservable._subscribe (http://localhost:9003/js/vendor.js:1096:28) [angular]
    at ArrayObservable.Observable.subscribe (http://localhost:9003/js/vendor.js:51:27) [angular]
    at MapOperator.call (http://localhost:9003/js/vendor.js:1359:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MergeAllOperator.call (http://localhost:9003/js/vendor.js:1495:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at FirstOperator.call (http://localhost:9003/js/vendor.js:3661:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at CatchOperator.call (http://localhost:9003/js/vendor.js:2945:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MapOperator.call (http://localhost:9003/js/vendor.js:1359:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at CatchOperator.call (http://localhost:9003/js/vendor.js:2945:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MergeMapOperator.call (http://localhost:9003/js/vendor.js:1634:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MapOperator.call (http://localhost:9003/js/vendor.js:1359:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MergeMapOperator.call (http://localhost:9003/js/vendor.js:1634:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MergeMapOperator.call (http://localhost:9003/js/vendor.js:1634:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at MapOperator.call (http://localhost:9003/js/vendor.js:1359:23) [angular]
    at Observable.subscribe (http://localhost:9003/js/vendor.js:48:22) [angular]
    at http://localhost:9003/js/vendor.js:82:38 [angular]
    at new ZoneAwarePromise (http://localhost:9003/js/polyfills.js:4433:29) [angular]
    at Observable.forEach (http://localhost:9003/js/vendor.js:81:16) [angular]
    at http://localhost:9003/js/app.js:10086:18 [angular]
    at new ZoneAwarePromise (http://localhost:9003/js/polyfills.js:4433:29) [angular]
    at Router.runNavigate (http://localhost:9003/js/app.js:10025:16) [angular]
    at http://localhost:9003/js/app.js:9994:51 [angular]
    at Object.onInvoke (http://localhost:9003/js/app.js:4990:37) [angular]
    at Zone.1062.Zone.run (http://localhost:9003/js/polyfills.js:3830:43) [angular => angular]
    at http://localhost:9003/js/polyfills.js:4417:57 [angular]
    at Object.onInvokeTask (http://localhost:9003/js/app.js:4981:37) [angular]
    at ZoneDelegate.1062.ZoneDelegate.invokeTask (http://localhost:9003/js/polyfills.js:4070:36) [angular]
    at Zone.1062.Zone.runTask (http://localhost:9003/js/polyfills.js:3870:47) [<root> => angular]
    at drainMicroTaskQueue (http://localhost:9003/js/polyfills.js:4250:35) [<root>]
    at HTMLDocument.ZoneTask.invoke (http://localhost:9003/js/polyfills.js:4128:25) [<root>]
filipesilva commented 7 years ago

@keyiis @jruef is this still a problem for you? Can you upload a repository where we can see this problem?

keyiis commented 7 years ago

After I update angular2 to angular4 and modify many code to adapt angular4,all work fine,But I still don't know why.

jruef commented 7 years ago

@filipesilva The issue vanished after upgrading to angular 4.

filipesilva commented 7 years ago

I'm glad to hear this isn't an issue anymore for you 👍

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.