question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multicompiler with multiple output paths breaks WDS

See original GitHub issue

Moved from https://github.com/webpack/webpack/issues/3091 - by @drphelps:

I’m submitting a feature request

Webpack version: 2.x

Please tell us about your environment: OSX 10.x

Current behavior: Currently, a Multicompiler instance with a different output.path specified for each config will boil the outputPath property down to a “common” path. I’m referring to this block of code https://github.com/webpack/webpack/blob/547295ca0e91dd5bb2c446e2df19c887c6aa053c/lib/MultiCompiler.js#L51-L63. This breaks WDS filename resolution.

Expected/desired behavior: WDS should serve resources from both paths or at least offer the ability to choose the first/preferred output.path when constructing the filename. I need to be able to output my files to separate (not necessarily nested) directories without breaking resolution.

  • What is the motivation / use case for changing the behavior? In my setup, I am trying to build two separate apps in parallel and I need to be able to share resources between the two, including async modules. Consider the following config:
module.exports = [
  {
    context: __dirname,
    entry: "./app.js",
    output: {
      filename: "app.js",
      path: path.resolve(__dirname, './app/dist'),
      publicPath: '/static/javascript/dist/'
    },
    ...
  },
  {
    context: __dirname,
    entry: "./widget.js",
    output: {
      filename: "widget.js",
      path: path.resolve(__dirname, './widget/dist'),
      publicPath: '/widget/dist/'
    },
    ...
  }
]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:25
  • Comments:20 (4 by maintainers)

github_iconTop GitHub Comments

13reactions
akinneecommented, Feb 6, 2017

Any update on this?

6reactions
ywmailcommented, Dec 15, 2016

part of the code:

server.js

const telcoConfig = require('./config/webpack.dev')({ env: 'development', app: 'telco' });
const marketplaceConfig = require('./config/webpack.dev')({ env: 'development', app: 'marketplace' });

webpack.dev.js

const hotMiddlewareScript = 'webpack-hot-middleware/client?path=__webpack_hmr&timeout=20000&reload=true&dynamicPublicPath=true';

    return webpackMerge(commonConfig({ env: ENV, app: app }), {

        entry: {

            'polyfills': ['./src/' + app + '/polyfills.browser.ts', hotMiddlewareScript],
            'vendor': ['./src/' + app + '/vendor.browser.ts', hotMiddlewareScript],
            'main': ['./src/' + app + '/main.browser.ts', hotMiddlewareScript]

        },

        devtool: 'cheap-module-source-map',

        output: {

            path: helpers.root('dist/' + app),

            publicPath: '/' + app + '/',

            filename: '[name].bundle.js',

            sourceMapFilename: '[name].map',

            chunkFilename: '[id].chunk.js',

            library: 'ac_[name]',
            libraryTarget: 'var',
        },

        plugins: [
        ],

    })
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create multiple output paths in Webpack config
Webpack does support multiple output paths. Set the output paths as the entry key. And use the name as output template. webpack config:...
Read more >
webpack/webpack - Gitter
Any ideas why when using the multi-compiler setup, the [name] value provided to output.filename is always just "main" and not the value I ......
Read more >
06 - Create multiple output paths in Webpack - YouTube
In this series for Webpack, I'll show you the basics and how to use it, hopefully, it's useful for ...
Read more >
2019-January.txt - GCC, the GNU Compiler Collection
The MALLOC_TRACE path can only be supplied as an environment variable. ... The test file below compiles to something breaking that assumption when...
Read more >
binary image file: Topics by Science.gov
These are slides about extracting the data from the LCM vk4 formatted output file. The following is covered: vk4 file produced by Keyence...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found