shama / webpack-stream

:tropical_drink: Run webpack through a stream interface
MIT License
1.4k stars 123 forks source link

fixed single output only bug #212

Closed azt3k closed 3 years ago

azt3k commented 5 years ago

hard coding a default of '[hash].js' for config.output.filename means that multiple outputs don't work.

shama commented 5 years ago

Hmm weird, can you post an example config for me to try?

azt3k commented 5 years ago
const webpack = require('webpack');
const env = process.env.ENV || 'local';

module.exports = {
    mode: 'development',
    entry: {
        all: [
            'webpack/hot/dev-server?path=http://localhost:9000/__webpack_hmr',
            __dirname + '/app/client/js/index.js'
        ],
        'style-loader': [
            'webpack/hot/dev-server?path=http://localhost:9000/__webpack_hmr',
            __dirname + '/app/client/js/style-loader.js'
        ]
    },
    output: {
        path: __dirname + '/public/resources/js'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: {
                    loader: 'babel-loader?cacheDirectory=.tmp/' + env
                }
            },
            {
                test: /\.css$/,
                use: ['style-loader', 'css-loader']
            },
            {
                test: /\.(png|woff|woff2|eot|ttf|svg|gif)$/,
                use: {
                    loader: 'url-loader?limit=100000'
                }
            }
        ]
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin()
    ]
};