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

@reactea/core

v1.0.0-alpha.3

Published

SASS/SCSS support for Reactea.

Downloads

1

Readme

@reactea/core

@reactea/core is a Webpack configuration package that provides the basic configuration for a React application. It is designed to be extendable and configurable via other @reactea packages.

Ideally, you'll only use baseConfig unless you're creating a custom base. Extensions should be compatible with baseConfig.

Installation

To install @reactea/core, run the following command:

npm install --save-dev @reactea/core

Usage

In your webpack.config.js file, import @reactea/core and call the default export function to obtain the base configuration.

webpack.config.js:

import { createConfig, extendConfig } from "@reactea/config";
import baseConfig from "@reactea/core/css";

export default function myConfig() {
  const config = createConfig();

  extendConfig(reactea, baseConfig());

  return config;
}

src/react-app-env.d.ts:

/// <reference types="@reactea/core/env" />

Configuration

The base configuration includes the following:

  • coreConfig: Basic Webpack configuration for a React application.
  • htmlConfig: Configuration for generating an HTML file with Webpack and injecting the appropriate script tags.
  • jsConfig: Configuration for processing JavaScript files with SWC and optionally enabling React Fast Refresh.
  • svgConfig: Configuration for processing SVG files with the @svgr/webpack loader.
  • cssConfig: Configuration for processing CSS files with PostCSS and the appropriate loaders.
  • imageConfig: Configuration for processing image files with the asset loader.

These configurations can be extended or overridden via the extendConfig function provided by the @reactea/config package.

Core Configuration

@reactea/core/core provides a configuration object for a basic Webpack configuration for a React application. It includes support for ESLint, process.env, and copying the public directory to the build output.

myConfig.ts:

import { createConfig, extendConfig } from "@reactea/config";
import coreConfig from "@reactea/core/core";

export default function myConfig() {
  const config = createConfig();

  extendConfig(reactea, coreConfig());

  return config;
}

Configuration

The coreConfig object includes the following:

  • entry: The entry point of the application, which defaults to "./src/index.js".
  • output: The output directory and filename for the generated JavaScript bundle, which defaults to "dist/js/[name].[contenthash:8].js".
  • outputPath: The output directory for generated files, which defaults to "dist".
  • publicPath: The public URL for the output directory, which defaults to "/".
  • resolve: Configuration for resolving modules.
  • module: Configuration for processing files with loaders.
  • plugins: A list of Webpack plugins to apply.

Note that coreConfig does not accept any parameters. If you need to customize the configuration,

HTML Configuration

@reactea/core/html provides a configuration object for generating an HTML file with Webpack and injecting the appropriate script tags. By default, it generates an index.html file in the public directory, and injects the generated script tags. It also inlines the runtime chunk if the application is being built for production.

myConfig.ts:

import { createConfig, extendConfig } from "@reactea/config";
import htmlConfig from "@reactea/core/html";

export default function myBaseConfig() {
  const config = createConfig();

  // ...
  extendConfig(reactea, htmlConfig());

  return config;
}

Parameters

  • htmlFiles (default: ["index.html"]): An array of HTML files to generate and inject script tags into.

JS Configuration

@reactea/core/js provides a configuration object for processing JavaScript files with SWC and React Fast Refresh. By default, it includes support for TypeScript, JSX, Flow, and some ESnext features, and compiles application JS with SWC. It also includes experimental support for React Fast Refresh.

myConfig.ts:

import { createConfig, extendConfig } from "@reactea/config";
import jsConfig from "@reactea/core/js";

export default function myBaseConfig() {
  const config = createConfig();

  // ...
  extendConfig(reactea, jsConfig());

  return config;
}

SVG Configuration

@reactea/core/svg provides a configuration object for processing SVG files with the @svgr/webpack loader. By default, it configures the loader to use the @svgr/webpack plugin to optimize SVG files and generate React components.

myConfig.ts:

import { createConfig, extendConfig } from "@reactea/config";
import svgConfig from "@reactea/core/svg";

export default function myBaseConfig() {
  const config = createConfig();

  // ...
  extendConfig(reactea, svgConfig());

  return config;
}

CSS Configuration

@reactea/core/css provides a configuration object for processing CSS files with PostCSS and the appropriate loaders. By default, it includes support for importing CSS files and CSS modules.

myConfig.ts:

import { createConfig, extendConfig } from "@reactea/config";
import cssConfig from "@reactea/core/css";

export default function myBaseConfig() {
  const config = createConfig();

  // ...
  extendConfig(reactea, cssConfig());

  return config;
}

Image Configuration

@reactea/core/image provides a configuration object for processing image files with the asset loader. By default, it includes support for BMP, GIF, JPEG, PNG, and AVIF images, and embeds small images as data URLs to avoid requests.

myConfig.ts:

import { createConfig, extendConfig } from "@reactea/config";
import baseConfig from "@reactea/core";

export default function myBaseConfig() {
  const config = createConfig();

  // ...
  extendConfig(reactea, baseConfig());

  return config;
}