madskristensen / WebPackTaskRunner

A Visual Studio extension
Other
39 stars 16 forks source link

Rollback to an older version of the Extension? #43

Open sidkalluri opened 7 years ago

sidkalluri commented 7 years ago

I'm on VS2015 and the Taskrunner is 1.5.91.

I see a couple of issues with this update.

scottaddie commented 7 years ago

@asdkalluri Which version of Webpack are you using?

sidkalluri commented 7 years ago

@scottaddie Currently on "webpack": "1.15.0"

sidkalluri commented 7 years ago

I was able to generate a source map by adding devtool: "source-map" to the config file. I never had to do this before. However, my production commands still generate the same output as the Development commands. Please advise.

"use strict";
require('es6-promise').polyfill();
var path = require('path');

module.exports = {
    context: path.join(__dirname, 'app'),
    entry: "./index.js",
    devtool: "source-map",
    output: {
        path: path.join(__dirname, 'app'),
        filename: "./index.bundle.js"
    },
    devServer: {
        contentBase: ".",
        host: "localhost",
        port: 9000
    },
    module: {
        loaders: [
            {
                test: /\.css$/,
                loaders: ['style', 'css'],
            },
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                loader: "babel-loader",
                query: {
                    presets: ['es2015', 'react']
                }
            }
        ]
    },
    resolve: {
        extensions: ['','.jsx', '.js', '.json']
    },
    externals: {
        // Use external version of React (from CDN for client-side, or
        // bundled with ReactJS.NET for server-side)
        react: 'React',
        'react-dom': 'ReactDOM'
    }
};
sidkalluri commented 7 years ago

Adding this line did minify the output file. But it generated a giant source map file (10 times the size of the bundle js file). And now, it generates the minified file irrespective of the dev/prod commands. Is there any other setting that I'm missing? Also, were these(Plugins,devtool) implicitly added to the earlier versions of the task Runner?

plugins:[
    new webpack.optimize.UglifyJsPlugin()
    ],
isaacrlevin commented 7 years ago

I think removing the -d and -p in the cmd call caused this. @asdkalluri Do you have seperate prod and dev webpack config files? If so, may I see them?

sidkalluri commented 7 years ago

@isaac2004 I only have one file, the contents of which I've pasted in the comments above. Based on how I invoke the TaskRunner, the Production Command used to automatically minify etc.

isaacrlevin commented 7 years ago

Yea so I know what the issue is. I put in fix #40 to resolve an issue that I saw here https://github.com/webpack/webpack/issues/1385

However this seems to bomb if you don't specify that flag when you don't have sourcemaps setup. This may be a limitation of the extension since it just calls into the CLI with a config file.

@madskristensen @scottaddie What are your thoughts here? The true fix to this is parse the config file for sourcemap settings and not add the flag if present. This becomes more difficult with nested webpack configs