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

reach-et-webpack-setup

v2.4.3

Published

Webpack config for ET Tools

Downloads

13

Readme

reach-et-webpack-setup

Webpack set up for ET projects

Plugins

Loaders

Installation

  npm i --save-dev reach-et-webpack-setup

Config

Create at your root a folder called webpack and add a config.yml and add the following:

default: &default
  cue_url: https://localhost # Sets out your default local url (incase different)
  
  source_path: assets #root path to your assets folder
  image_entry: Images  # name of image folder
  stylesheets_entry: css # name of css folder
  
  public_dev_output: https://localhost/webpack #path set through proxy used by webpack server
  public_root_path: /cue-web/dist/ # output path
 
 # You can add your own config here to like:
 
 # for HTML plugin
 html_output: '../index.html'
  html_template: 'index.html'
  public_output_path: /dist # output folder 
  
  # Templates plugin
  templates_path: template
  yaml_output: /etc/escenic/cue-web # where the yaml files are outputted in docker image
  start_up_script: /usr/bin/startup.sh # startup script fired when dev-server starts
  
  # google tag manager
  google_tag_id: GTM-PXC7ST9
  
 # Image and other static assets that can be used
  static_assets_extensions:
    - .jpg
    - .jpeg
    - .png
    - .gif
    - .tiff
    - .ico
    - .svg
    - .eot
    - .otf
    - .ttf
    - .woff
    - .woff2
	
  extensions:
    - .mjs
    - .js
    - .css
    - .module.css
    - .png
    - .svg
    - .gif
    - .ico
    - .jpeg
    - .jpg

development:
  <<: *default
  # Add additional Dev config here

  # Webpack dev server config - Reference: https://webpack.js.org/configuration/dev-server/
  dev_server:
    https: false
    http2: false
    host: 0.0.0.0
    port: 3131
    public: https://localhost:3131
    hot: true
    overlay: true
    compress: true
    disable_host_check: true
    use_local_ip: false
    quiet: false
    client_log_level: "debug"

    headers:
      Access-Control-Allow-Origin: "*"
      Access-Control-Allow-Methods: "GET, POST, PUT, DELETE, PATCH, OPTIONS"
      Access-Control-Allow-Headers: "X-Requested-With, content-type, Authorization"
    # watch: true
    history_api_fallback: true
    watch_options:
      aggregateTimeout: 300
      ignored: "**/node_modules/**"
      poll: 1000

production:
  <<: *default
  # Add additional production config here

Then create a webpack.config.js file:

/* eslint-env node */
const { webpackConfig } = require('reach-et-webpack-setup');
const { merge } = require('webpack-merge');

module.exports = merge(webpackConfig, {
  entry: { index: 'my-index.js' },
});

For a more advanved example you can pull back the config object with the data listed in config.yml (please note they will now be camelCase):

/* eslint-env node */
const { TemplatePlugin, getFiles } = require('reach-et-templates-plugin');
const { webpackConfig, config } = require('reach-et-webpack-setup');
const GoogleTagManagerPlugin = require('reach-et-webpack-google-tag-manager-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { merge } = require('webpack-merge');
const { env } = require('process');

// See reach-et-templates-plugin
const files = getFiles(config);
// Use config data
const {
  cueUrl,
  googleTagId,
  htmlOutput,
  htmlTemplate,
  publicDevOutput,
  publicOutputPath,
  publicRootPath,
  startUpScript,
  yamlOutput,
} = config;

const publicPath = env.NODE_ENV === 'development' ? publicDevOutput : publicOutputPath;

// You can pass any webpack config you want that will append to the config please see https://webpack.js.org/
module.exports = merge(webpackConfig, {
  entry: { ...files },
  plugins: [
    // See  reach-et-templates-plugin
    new TemplatePlugin({
      cueUrl: cueUrl,
      js: publicRootPath,
      publicPath,
      output: yamlOutput,
      shellScript: startUpScript,
    }),
	// see https://webpack.js.org/plugins/html-webpack-plugin/
    new HtmlWebpackPlugin({
      filename: htmlOutput,
      alwaysWriteToDisk: true,
      template: htmlTemplate,
      excludeChunks: Object.keys(files),
    }),
    // See reach-et-webpack-google-tag-manager-plugin
    new GoogleTagManagerPlugin({
      id: googleTagId,
    }),
  ],
});

Copyright (c) 2019 "Reach Shared Services Ltd"