4.0.4 • Published 3 years ago

ale-webpack v4.0.4

Weekly downloads
7
License
MIT
Repository
github
Last release
3 years ago

ale-webpack

为了更容易的使用 webpack, ale-webpack 在 webpack 的基础上增加了一些默认配置和快捷配置 ale, 配置的对象格式和 webpack 保持一致.

安装

## 安装命令
npm install ale-cli -D

## default
npm run dev

## prod
npm run build

package.json

{
  "scripts": {
    "dev": "ale dev",
    "build": "ale build prod"
  }
}

配置例子:

项目根目录创建一个配置文件.alerc.js

import path from 'path';
import { version } from './package.json';

export default {
  entry: './src/app.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js',
  },
  optimization: {
    splitChunks: {
      cacheGroups: {
        vendor: {
          test: /[\\/]node_modules[\\/]/,
          chunks: 'all',
          name: 'vendor',
          priority: -10,
          enforce: true,
        },
      },
    },
  },
  // ...webpack config

  ale: {
    html: {
      // object || array
      title: '\u200E',
      appMountId: 'root',
      mobile: true,
      stylesheets: [], // css
      scripts: [], //pre scripts
      chunks: ['vendor', 'main'],
    },
    postcssPlugins: [],
    babelEnv: {},
    babelPlugins: [
      ['styled-components', { displayName: false }],
      ['import', { libraryName: 'antd-mobile', style: true }, 'antd-mobile'],
      [
        'import',
        {
          libraryName: 'lodash',
          camel2DashComponentName: false,
          libraryDirectory: '',
        },
        'lodash',
      ],
    ],
    define: {
      baseURL: JSON.stringify('https://www.github.com'),
    },
    fileOptions: {
      //jpg, svg, img ... res  file-loader options
      esModule: true,
    },
  },
};

export const prod = {
  output: {
    filename: 'res/j/app.[hash].js',
    chunkFilename: 'res/j/[id][chunkhash].js',
    publicPath: 'https://img.99bill.com/',
  },
  mode: 'production',
  ale: {
    html: {
      filename: 'seashell/webapp/xxxxx/default.html',
    },
    css: {
      filename: 'res/c/[hash].css',
      chunkFilename: 'res/c/[chunkhash].chunk.css',
    },
    fileOptions: {
      outputPath: 'res/i',
    },
    zip: {
      filename: `pkg@${version}.zip`,
    },
  },
};

typescript

type-check

add tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "moduleResolution": "node",
    "allowJs": true,
    "noEmit": true,
    "strict": true,
    "isolatedModules": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "jsx": "react",
    "baseUrl": "./",
    "paths": {
      "~/*": ["./src/*"]
    }
  },
  "include": ["src/*"]
}

and just run tsc and that’s it! tsc will type-check your .ts and .tsx files. Feel free to add the --watch flag to either tool to get immediate feedback when anything changes. [post]

4.0.4

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.0-6

3 years ago

4.0.0-5

3 years ago

4.0.0-3

3 years ago

4.0.0-4

3 years ago

4.0.0-2

3 years ago

4.0.0-0

3 years ago

4.0.0-1

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

4 years ago

3.0.0-beta.1

4 years ago

3.0.0

4 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.1.19

5 years ago

1.1.18

5 years ago

1.1.17

5 years ago

1.1.16

5 years ago

1.1.15

5 years ago

1.1.14

5 years ago

1.1.13

5 years ago

1.1.12

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago