@axew/jugg
What is Jugg?
Last updated 11 days ago by daief .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @axew/jugg 
SYNC missed versions from official npm registry.

Jugg

What is Jugg?

A front-end scaffold ????️ work with Webpack.

basic command

# start a webpack-dev-server
$ jugg dev

# build with webpack
$ jugg build

directory

Simple directory can be something like this, default entry can be src/index.{tsx?|jsx?}. tsconfig.json is necessary only when you use TypeScript.

.
├── src
│   └── index.ts
└── tsconfig.json

config

Create a file named .juggrc.js, .juggrc.ts, jugg.config.js, etc. Or write config object in package.json.

interface JuggConfig {
  /**
   * publicPath of webpack, default '/'
   */
  publicPath?: string;
  /**
   * output path of webpack, default 'dist'
   */
  outputDir?: string;
  plugins?: PluginCfgSchema[];
  define?: { [k: string]: any };
  /**
   * open chunks config? default true
   */
  chunks?: boolean;
  /**
   * sourceMap, default true
   */
  sourceMap?: boolean;
  webpack?: JuggWebpack;
  /**
   * ts-loader custom transformers, only work when ts-loader is enabled
   */
  tsCustomTransformers?: {
    before?: PluginCfgSchema[];
    after?: PluginCfgSchema[];
  };
  /**
   * bundle file name, default `[name].[chunkhash]`.
   * affect js, css
   */
  filename?: string;
  /**
   * built-in base webpack html plugin config.
   * set false to rm plugin.
   */
  html?: false | { [k: string]: any };
  /**
   * config of css, less, postcss...
   */
  css?: {
    loaderOptions?: {
      /**
       * https://github.com/postcss/postcss-loader/tree/v3.0.0#options
       */
      postcss: {
        config?: {
          context?: any;
          path?: any;
        };
        plugins?: any;
        [k: string]: any;
      };
    };
  };
}

type JuggWebpack = webpack.Configuration | (
  param: {
    config: webpackChain.Config;
    webpack: webpack.Configuration;
  }
) => void | webpack.Configuration;

type PluginCfgSchema = string | [string, { [k: string]: any }?];

env

  • ANALYZE
    • enable webpack-bundle-analyzer
  • ANALYZE_PORT
    • webpack-bundle-analyzer server port, default 8888
  • ANALYZE_DUMP
    • generate stats file while ANALYZE_DUMP exist
  • FORK_TS_CHECKER
    • set none, disbale fork-ts-checker-webpack-plugin
  • HARD_SOURCE
    • set none, disbale hard-source-webpack-plugin

TS or JS

Both TS and JS can be used together in a project with jugg. There are several situations with handleing TS and JS:

  • Default & Recommended: create a tsconfig.json, then jugg will open ts-loader and use it to compile ts, tsx, js, tsx. babel is needless here.
    • ts-loader: ts, tsx, js, jsx
    • babel: needless
  • Set config in .juggrc.js with jugg-plugin-babel. Babel plugin will rewrite built-in config of ts-loader for js and jsx and handle then with itself.
    • ts-loader: ts, tsx
    • babel: js, jsx
  • Set compileTs: true in jugg-plugin-babel config will clean all built-in ts-loader options. Babel handles all the file.
    • ts-loader: cleaned
    • babel: ts, tsx, js, jsx

Notice

  • import() works with "module": "esnext" in tsconfig.json, detail.

Current Tags

  • 0.0.21                                ...           latest (11 days ago)

19 Versions

  • 0.0.21                                ...           11 days ago
  • 0.0.20                                ...           a month ago
  • 0.0.19                                ...           a month ago
  • 0.0.18                                ...           3 months ago
  • 0.0.17                                ...           4 months ago
  • 0.0.15                                ...           4 months ago
  • 0.0.14                                ...           4 months ago
  • 0.0.13                                ...           4 months ago
  • 0.0.12                                ...           4 months ago
  • 0.0.11                                ...           4 months ago
  • 0.0.10                                ...           4 months ago
  • 0.0.9                                ...           5 months ago
  • 0.0.8                                ...           5 months ago
  • 0.0.7                                ...           5 months ago
  • 0.0.6                                ...           5 months ago
  • 0.0.4                                ...           5 months ago
  • 0.0.3                                ...           5 months ago
  • 0.0.2                                ...           5 months ago
  • 0.0.1 [deprecated]           ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 38
Last Day 0
Last Week 36
Last Month 96
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |