Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@peterbe
Created September 21, 2020 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterbe/53ae94dfb55a2b2660a831ec3307af9f to your computer and use it in GitHub Desktop.
Save peterbe/53ae94dfb55a2b2660a831ec3307af9f to your computer and use it in GitHub Desktop.
import { resolve } from "path";
export default {
/**
* Function that mutates the original webpack config.
* Supports asynchronous changes when a promise is returned (or it's an async function).
*
* @param {object} config - original webpack config.
* @param {object} env - options passed to the CLI.
* @param {WebpackConfigHelpers} helpers - object with useful helpers for working with the webpack config.
* @param {object} options - this is mainly relevant for plugins (will always be empty in the config), default to an empty object
**/
webpack(config, env, helpers, options) {
config.module.rules[4].use.splice(1, 0, {
loader: "@teamsupercell/typings-for-css-modules-loader",
options: {
banner:
"// This file is automatically generated from your CSS. Any edits will be overwritten.",
disableLocalsExport: true
}
});
// Use any `index` file, not just index.js
config.resolve.alias["preact-cli-entrypoint"] = resolve(
process.cwd(),
"src",
"index"
);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment