You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
The application has a compilation failed only on linux with ngtools/webpack
rimraf dist && node --max_old_space_size=2048 node_modules/webpack/bin/webpack.js --progress --profile --bail
The log given by the failure.
Normally this include a stack trace and some more information.
It fails at the end of the compilation, but as we can see in the log, it generates the dist folder with the build. I guess there is something wrong at the end of the build...
If I run this on linux, I have no issue:
node_modules/.bin/ngc -p tsconfig.ngc.json
So I guess, there is something specific in webpack ngtools/loader, but I don't know what.
Here is the webpack.prod.config:
/**
* Webpack Constants
*/
/**
* Imports
*/
var webpack = require('webpack');
var helpers = require('./helpers');
/**
* Webpack Plugins
*/
var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
var autoprefixer = require('autoprefixer');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var CompressionPlugin = require("compression-webpack-plugin");
var ngToolsWebpack = require('@ngtools/webpack');
/**
* Webpack configuration
*
* See: http://webpack.github.io/docs/configuration.html#cli
*/
module.exports = {
devtool: 'source-map',
entry: {
'polyfills': './config/polyfills.ts',
'vendor': './config/vendor.ts',
'app': './src/bootstrap/prod.bootstrap.ts' // our angular app
},
resolve: {
modules: [helpers.root('src'), helpers.root('node_modules')],
extensions: ['.ts', '.js', '.json', '.css', '.scss', '.html'],
alias: {
'app': 'src/app',
'common': 'src/common',
'moment':'moment/moment.js',
'jquery':'jquery/dist/jquery.js',
'file-saver':'file-saver/FileSaver.js',
}
},
output: {
path: helpers.root('dist'),
publicPath: '',
filename: 'js/[name].[hash].js',
chunkFilename: '[id].[hash].chunk.js'
},
module: {
rules: [
/*{
test: /\.ts$/,
enforce: 'pre',
loader: 'tslint-loader'
},*/
{
test: /\.ts$/,
loaders: [ '@ngtools/webpack'],
exclude: [/\.(spec|e2e)\.ts$/, /node_modules\/(?!(ng2-.+))/]
},
// copy those assets to output
{test: /\.png|\.jpe?g|\.gif|\.svg|\.woff|\.woff2|\.ttf|\.eot|\.ico|\.svg$/, loader: 'file-loader?name=fonts/[name].[hash].[ext]?'},
// Support for *.json files.
{test: /\.json$/, loader: 'json-loader'},
{
test: /\.css$/,
exclude: helpers.root('src', 'app'),
loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: ['css-loader', 'postcss-loader']})
},
{test: /\.css$/, include: helpers.root('src', 'app'), loader: 'raw-loader!postcss-loader'},
{
test: /\.(scss|sass)$/,
exclude: helpers.root('src', 'app'),
loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: ['css-loader', 'postcss-loader', 'sass-loader'], publicPath: '../'})
},
{test: /\.(scss|sass)$/, exclude: helpers.root('src', 'style'), loader: 'raw-loader!postcss-loader!sass-loader'},
{test: /\.html$/, loader: 'raw-loader'}
],
noParse: [/.+zone\.js\/dist\/.+/, /.+angular2\/bundles\/.+/, /angular2-polyfills\.js/]
},
// Add additional plugins to the compiler.
//
// See: http://webpack.github.io/docs/configuration.html#plugins
plugins: ( function() {
var plugins = [];
plugins.push(
new CommonsChunkPlugin({
name: ['vendor', 'polyfills']
})
);
plugins.push(
new webpack.LoaderOptionsPlugin({
//minimize: true,
//debug: false,
options: {
ts : {
'ignoreDiagnostics': [
2403, // 2403 -> Subsequent variable declarations
2300, // 2300 -> Duplicate identifier
2374, // 2374 -> Duplicate number index signature
2375, // 2375 -> Duplicate string index signature
2502 // 2502 -> Referenced directly or indirectly
]
},
/*tslint: {
emitErrors: false,
failOnHint: false
},*/
postcss: [
autoprefixer({
browsers: ['last 2 version']
})
]
}
})
);
// plugins.push(new DashboardPlugin());
plugins.push(
// Adding jQuery
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
"window.jQuery": 'jquery'
})
);
plugins.push(
// Adding Moment
new webpack.ProvidePlugin({
moment: 'moment'
})
);
plugins.push(
// Adding Moment
new webpack.ProvidePlugin({
moment: 'file-saver'
})
);
plugins.push(
// Inject script and link tags into html files
// Reference: https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
template: './src/public/index.html',
inject: 'body',
chunksSortMode: 'dependency'
})
);
plugins.push(
// Extract css files
// Reference: https://github.com/webpack/extract-text-webpack-plugin
// Disabled when in test mode or not in build mode
new ExtractTextPlugin('css/[name].[hash].css')
);
plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
},
sourceMap: false
}));
plugins.push(
// Copy assets from the public folder
// Reference: https://github.com/kevlened/copy-webpack-plugin
new CopyWebpackPlugin([{
from: helpers.root('src/public')
}])
);
plugins.push(
new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: /\.js$|\.css$/,
threshold: 10240,
minRatio: 0.8
})
);
plugins.push(new ngToolsWebpack.AotPlugin({
entryModule: helpers.root('src/bootstrap/prod.module#ProdModule'),
tsConfigPath: './tsconfig.aot.json',
}));
return plugins;
}())
};
OS?
Failed on Linux (Red Hat Enterprise Linux Server release 7.0). But working on Windows 7
Versions.
node 6.9.1
"@angular/compiler-cli": "2.4.7",
"@ngtools/webpack": "1.2.11",
"typescript": "2.0.10",
"webpack": "2.2.1",
Repro steps.
The application has a compilation failed only on linux with ngtools/webpack
rimraf dist && node --max_old_space_size=2048 node_modules/webpack/bin/webpack.js --progress --profile --bail
The log given by the failure.
It fails at the end of the compilation, but as we can see in the log, it generates the dist folder with the build. I guess there is something wrong at the end of the build...
Mention any other details that might be useful.
If I run this on linux, I have no issue:
node_modules/.bin/ngc -p tsconfig.ngc.json
So I guess, there is something specific in webpack ngtools/loader, but I don't know what.
Here is the webpack.prod.config:
And here is the tsconfig.ngc:
Any idea how could I have more info to make it work on linux?
The text was updated successfully, but these errors were encountered: