npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dztools/webpack-config-react

v2.4.0

Published

Webpack base, dev, and prod configurations for React + JavaScript templates.

Downloads

11

Readme

@dztools/webpack-config-react

Webpack base, dev, and prod configurations for React + JavaScript templates.

npm prettier license

Installation and Dependencies

To install the package:

[npm i -D || yarn add -D] @dztools/webpack-config-react

If peer dependencies are needed, run the following:

[npm i -D || yarn add -D] @hot-loader/react-dom webpack webpack-cli webpack-dev-server

Note: The version of @hot-loader/react-dom must match your local version of react and react-dom.

Usage

In your local webpack.base.js or webpack.common.js file:

const { webpackBaseConfig } = require('@dztools/webpack-config-react');

module.exports = webpackBaseConfig;

In your local webpack.dev.js file:

const { webpackDevConfig } = require('@dztools/webpack-config-react');

module.exports = webpackDevConfig;

In your local webpack.prod.js file:

const { webpackProdConfig } = require('@dztools/webpack-config-react');

module.exports = webpackProdConfig;

Notes

  • This package has been created with the needs of the React Scaffolder Yeoman generator in mind.
  • The base configuration expects both ./src/polyfills.js and ./src/index.jsx to exist for the entry point, and the build will fail if these files are not found.
  • Your React app will also need a local webpack.config.js file responsible for merging dev and prod configs with the base config as needed.

Example, basic webpack.config.js file:

const { merge } = require('webpack-merge');
const baseConfig = require('./build/webpack.base');

const envs = {
  development: 'dev',
  production: 'prod'
};

const env = envs[process.env.NODE_ENV || 'development'];
const envConfig = require(`./build/webpack.${env}.js`);

module.exports = merge(baseConfig, envConfig);

Extending and Customization

For adding or customizing Webpack configuration options, I recommend utilizing the webpack-merge package and documentation. The webpack-merge package allows for efficient Webpack configuration extension and customization.

Basic example:

const path = require('path');
const { merge } = require('webpack-merge');
const { webpackBaseConfig } = require('@dztools/webpack-config-react');

module.exports = merge(webpackBaseConfig, {
  resolve: {
    alias: {
      '@alias': path.resolve('path', 'to', 'directory')
    }
  }
});

License

MIT