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.

Implement new config

See original GitHub issue

Historically, the configuration has been done through the file webpack.haul.js. This proposal aims to achieve 2 things,

  1. Simplify configuring commonly needed features, such as including folders for transpilation
  2. Separate webpack configuration so that other tools can use it, e.g. - eslint-resolver-webpack
  3. Have flexibility to configure Haul’s options independent from Webpack

With the proposed approach, configuration will be done through a file called haul.config.js, which will look kinda like this:

export default {
  // haul specific options
  webpack: {
    // webpack configuration
  }
}

This allows us to have the flexibility to add additional options which are unrelated to webpack, and also allows us to switch the bundler to a different one in future.

The webpack field can be a plain object with webpack configuration, or a function which receives various arguments:

export default {
  // haul specific options
  webpack: ({ platform, production }) => ({
    // return custom config
  });
}

This mirrors a vanilla webpack config and it’s env argument. This makes it so that other tools can understand the webpack config. One could also extract the webpack configuration to a separate file (e.g. - webpack.config.js) which other tools can read.

Currently we pass a second argument defaults, which is convenient, but makes the config incompatible with tools which require vanilla webpack config. We’ll continue to support it, but we can also export a helper utility in case you need to support those tools:

import { createWebpackConfig } from 'haul';

export default {
  webpack: createWebpackConfig(({ platform }) => {
    entry: `./index.${platform}.js`,
    include: /node_modules/,
  }),
}

The createWebpackConfig utility can take some common options has return a webpack configuration function which takes the env argument. To override configurations from a confguration generated this way, you could do something like this:

import { createWebpackConfig } from 'haul';

export default {
  webpack: env => {
    const config = createWebpackConfig({
      entry: `./index.js`,
      include: /node_modules/,
    })(env);

    config.plugins.push(new CaseSensitivePathsPlugin());

    return config;
  },
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jukbencommented, Feb 7, 2018

As a team member of our Callstack Open Source Division – I’m on it. 💪

0reactions
thymikeecommented, Apr 17, 2018

Closed via #372

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with Configuration Files - Cisco
Use the following command to download a configuration file from a remote server to the running configuration. switch# copy scheme://url system:running-config ...
Read more >
Using the CLI to implement configuration changes
How to use the CLI to view the current configuration files. Use show commands to view the configuration for individual features, such as...
Read more >
How to Manage and Save Running Config on Cisco Devices
Learn how to save running config on Cisco devices and use other common CLI commands.
Read more >
Use 'configure replace' Instead of 'copy start run' - PacketLife.net
I am curious...can this command be used to write the startup config to a brand new CF card? I need to replace one...
Read more >
Chapter 1. Router Configuration and File Management - O'Reilly
You can use the copy tftp: command to configure the router via the TFTP: Router1# copy tftp://172.25.1.1/NEWCONFIG running-config Destination filename ...
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