Gerade diese dort setzen, um zu sehen, wenn jemand anderes dieses Problem wird mit ...Typoskript Kompilation extrem langsam> 12s
Ich habe einen Winkel 2 App mit Typoskript Aufbau wie mein Build-Tool mit webpack, es funktioniert alles gut , aber ich habe bemerkt, dass die Typoskript-Kompilierung super super langsam ist, ich bin gerade bei 12 Sekunden ...., und es ist ziemlich klar, dass das alles auf den Typoskript-Kompilierungsprozess zurückzuführen ist.
Ich habe ts- verwendet loader oder awesome-typscript-loader mit einem ähnlichen Ergebnis, wenn ich diesen Loader auskommentiere, fällt meine Build-Zeit auf etwa 1 sec ....
Nach einigen Forschung scheint es, als wäre es "normal", "langsame" Zeiten zu haben, wenn Typoskript kompiliert wird, aber ist 12sec das normale ??
Alte Beiträge deutete es aufgrund einer Knoten Versionskonflikt sein könnte, ich bin derzeit laufenden 4.4.2 ...
Jeder, wie unten ist mein webpack Code falls jemand Flecken dort etwas falsch .. der kommentierten Code im uglify Abschnitt bis zu einem gewissen ‚Fehler‘ beruht auf der Winkel 2 Seite ...
const path = require('path');
const merge = require('webpack-merge');
const webpack = require('webpack');
const NpmInstallPlugin = require('npm-install-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const TARGET = process.env.npm_lifecycle_event;
const PATHS = {
app: path.join(__dirname, 'app'),
dist: path.join(__dirname, 'dist')
};
const common = {
entry: {
vendor: ['./app/vendor.ts'],
main: ['./app/boot.component.ts']
},
output: {
filename: '[name].[hash].bundle.js',
path: PATHS.dist
},
resolve: {
extensions: ['', '.js', '.ts']
},
plugins: [
new HtmlWebpackPlugin({
title: 'Qarrot Performance',
template: 'index.template.ejs',
commonStyles: [
'/public/styles/vendor/normalize.css',
'/public/styles/main.css'
],
commonScripts: [],
baseHref: '/',
unsupportedBrowser: true,
mobile: true,
appMountId: 'app'
}),
],
module: {
loaders: [
{
test: /\.ts$/,
exclude: /node_modules/,
loaders: ['ts-loader']
},
{
test: /\.scss$/,
loader: 'raw-loader!sass-loader'
},
{
test: /\.html$/,
loader: "html"
}
]
}
}
// Dev Settings
if(TARGET === 'start' || !TARGET) {
module.exports = merge(common, {
devtool: 'eval-source-map',
devServer: {
contentBase: PATHS.build,
historyApiFallback: true,
hot: true,
inline: true,
progress: true,
stats: 'errors-only',
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new NpmInstallPlugin({
save: true
})
]
});
}
// Prod Settings
if(TARGET === 'build') {
module.exports = merge(common, {
devtool: 'cheap-module-source-map',
plugins: [
// new webpack.optimize.UglifyJsPlugin({
// beautify: false,
// mangle: false,
// compress : { screw_ie8 : true },
// comments: false
// }),
new webpack.optimize.DedupePlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new CopyWebpackPlugin([
{ from: 'public', to: 'public' }
]),
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor', 'manifest']
}),
]
});
}
ich bin auch auf einem Mac laufen Angular 2 beta.15 und webpack Version 1.12, unten ist mein tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"compileOnSave": false,
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
Hey @basart danke für deinen Vorschlag, ich habe meine Frage mit meiner tsconfig aktualisiert ... Ich hatte diese Option nicht eingestellt, aber es hatte keine große Wirkung, als ich es aber hinzufügte ... –