vendredi 27 janvier 2017

Laravel elixir watching performance

While gulp watching, After I updated a .ts file, it took too long time to build.

This is my current gulpfile, please advise me where I can make better for building quicker after updated a file.

elixir(function (mix) {
    mix.sass('app.scss');

    mix.webpack(
        {
            app: 'main.ts',
            vendor: 'vendor.ts'
        },
        {
            module: {
                loaders: [
                    {
                        test: /\.html$/,
                        loader: 'raw-loader'
                    },
                    {
                        test: /\.scss$/,
                        loaders: ["raw", "sass"]
                    },
                    {
                        test: /\.ts$/,
                        loader: 'ts-loader',
                        exclude: /node_modules/
                    }
                ]
            },
            plugins: [
                new webpack.optimize.CommonsChunkPlugin({
                    name: 'app',
                    filename: 'app.js',
                    minChunks: 5,
                    chunks: [
                        'app'
                    ]
                }),
                new webpack.optimize.CommonsChunkPlugin({
                    name: 'vendor',
                    filename: 'vendor.js',
                    minChunks: Infinity
                }),
                new webpack.ProvidePlugin({
                    '__decorate': 'typescript-decorate',
                    '__extends': 'typescript-extends',
                    '__param': 'typescript-param',
                    '__metadata': 'typescript-metadata'
                })
            ],
            resolve: {
                extensions: ['', '.js', '.ts']
            },
            debug: true,
            devtool: 'source-map'
        },
        'public/js',
        'resources/assets/typescript'
    );

    if (isProduction) {
        mix.copy('node_modules/font-awesome/fonts', 'public/build/fonts')

        var versioningFile = [
            'css/app.css',
            'js/app.js',
            'js/vendor.js'
        ];

        versioningFile = versioningFile.concat([
            'js/all.js',
            'css/all.css'
        ]);

        mix.scripts([
            'vendor.js',
            'app.js'
        ], 'public/js/all.js', 'public/js');

        mix.styles([
            'app.css'
        ], 'public/css/all.css', 'public/css');

        mix.version(versioningFile);
    } else {
        mix.copy('node_modules/font-awesome/fonts', 'public/fonts')

        mix.browserSync({
            files: [
                "public/js/app.js",
                "public/css/app.css"
            ],
            proxy: "laravel.dev"
        });
    }
});

The versions I'm using,

"laravel-elixir": "^5.0.0",
"laravel-elixir-webpack-ex": "0.0.5",



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire