create-packer 1.24.31 → 1.24.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.24.31",
3
+ "version": "1.24.32",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -1,6 +1,12 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
2
  module.exports = {
3
- content: ['./index.html', './main.tsx', './pages/**/*.{ts,tsx,js,jsx}', './domain/**/*.{ts,tsx,js,jsx}', './components/**/*.{ts,tsx,js,jsx}'],
3
+ content: [
4
+ './index.html',
5
+ './main.tsx',
6
+ './pages/**/*.{ts,tsx,js,jsx}',
7
+ './domain/**/*.{ts,tsx,js,jsx}',
8
+ './components/**/*.{ts,tsx,js,jsx}'
9
+ ],
4
10
  theme: {
5
11
  extend: {}
6
12
  },
@@ -1,2 +1,18 @@
1
1
  declare const BASE_URL: string
2
2
  declare const API_HOST: string
3
+
4
+ declare module '*.css'
5
+ declare module '*.less'
6
+ declare module '*.scss'
7
+ declare module '*.png'
8
+ declare module '*.webp'
9
+ declare module '*.svg' {
10
+ import * as React from 'react'
11
+
12
+ export const ReactComponent: React.FunctionComponent<
13
+ React.ComponentProps<'svg'> & { title?: string }
14
+ >
15
+ export function ReactComponent(props: React.SVGProps<SVGSVGElement>): React.ReactElement
16
+ const url: string
17
+ export default url
18
+ }
@@ -0,0 +1,3 @@
1
+ .root {
2
+ @apply flex justify-center items-center;
3
+ }
@@ -1,5 +1,5 @@
1
- import './home.css'
1
+ import styles from './home.module.css'
2
2
 
3
3
  export default function Home() {
4
- return <div className={'flex justify-center items-center'}>sdsddds</div>
4
+ return <div className={styles.root}>sdsddds</div>
5
5
  }
@@ -7,7 +7,7 @@ import MiniCssExtractPlugin from 'mini-css-extract-plugin'
7
7
  import EslintWebpackPlugin from 'eslint-webpack-plugin'
8
8
  import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
9
9
  import * as dotenv from 'dotenv'
10
- import { ROOT, OUTPUT } from './webpack_config/constant.mjs'
10
+ import { ROOT, OUTPUT, createCssLoader, createStyleLoader } from './webpack_config/index.mjs'
11
11
 
12
12
  function getEnvConfig(mode) {
13
13
  const envConfig = dotenv.config({ path: mode ? `.env.${mode}` : '.env' }).parsed
@@ -82,9 +82,14 @@ export default function (env) {
82
82
  },
83
83
  {
84
84
  test: /\.css$/,
85
+ exclude: /\.module\.css$/,
86
+ use: [createStyleLoader(env.WEBPACK_BUILD), createCssLoader(), 'postcss-loader']
87
+ },
88
+ {
89
+ test: /\.module\.css$/,
85
90
  use: [
86
- env.WEBPACK_BUILD ? MiniCssExtractPlugin.loader : 'style-loader',
87
- 'css-loader',
91
+ createStyleLoader(env.WEBPACK_BUILD),
92
+ createCssLoader(true),
88
93
  'postcss-loader'
89
94
  ]
90
95
  }
@@ -113,6 +118,7 @@ export default function (env) {
113
118
  splitChunks: {
114
119
  minChunks: 1,
115
120
  cacheGroups: {
121
+ default: false,
116
122
  react: {
117
123
  test: /[\\/](react|react-dom)[\\/]/,
118
124
  chunks: 'all',
@@ -121,7 +127,8 @@ export default function (env) {
121
127
  vendor: {
122
128
  test: /[\\/](node_modules)[\\/]/,
123
129
  chunks: 'all',
124
- name: 'vendor'
130
+ name: 'vendor',
131
+ priority: -1
125
132
  }
126
133
  }
127
134
  }
@@ -0,0 +1,2 @@
1
+ export * from './constant.mjs'
2
+ export * from './styles.mjs'
@@ -0,0 +1,22 @@
1
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin'
2
+ import { SCOPE_CLASS_NAME } from './constant.mjs'
3
+
4
+ export function createStyleLoader(build) {
5
+ return build ? MiniCssExtractPlugin.loader : 'style-loader'
6
+ }
7
+
8
+ export function createCssLoader(module) {
9
+ if (module) {
10
+ return {
11
+ loader: 'css-loader',
12
+ options: {
13
+ importLoaders: 1,
14
+ modules: {
15
+ mode: 'local',
16
+ localIdentName: SCOPE_CLASS_NAME
17
+ }
18
+ }
19
+ }
20
+ }
21
+ return 'css-loader'
22
+ }
@@ -1,22 +0,0 @@
1
- # ignore most things, include some others
2
- /*
3
- /.*
4
-
5
- !bin/
6
- !lib/
7
- !docs/
8
- !package.json
9
- !package-lock.json
10
- !README.md
11
- !CONTRIBUTING.md
12
- !LICENSE
13
- !CHANGELOG.md
14
- !example/
15
- !scripts/
16
- !tap-snapshots/
17
- !test/
18
- !.travis.yml
19
- !.gitignore
20
- !.gitattributes
21
- !coverage-map.js
22
- !index.js
@@ -1,22 +0,0 @@
1
- # ignore most things, include some others
2
- /*
3
- /.*
4
-
5
- !bin/
6
- !lib/
7
- !docs/
8
- !package.json
9
- !package-lock.json
10
- !README.md
11
- !CONTRIBUTING.md
12
- !LICENSE
13
- !CHANGELOG.md
14
- !example/
15
- !scripts/
16
- !tap-snapshots/
17
- !test/
18
- !.travis.yml
19
- !.gitignore
20
- !.gitattributes
21
- !coverage-map.js
22
- !index.js
@@ -1,22 +0,0 @@
1
- # ignore most things, include some others
2
- /*
3
- /.*
4
-
5
- !bin/
6
- !lib/
7
- !docs/
8
- !package.json
9
- !package-lock.json
10
- !README.md
11
- !CONTRIBUTING.md
12
- !LICENSE
13
- !CHANGELOG.md
14
- !example/
15
- !scripts/
16
- !tap-snapshots/
17
- !test/
18
- !.travis.yml
19
- !.gitignore
20
- !.gitattributes
21
- !coverage-map.js
22
- !index.js
@@ -1,24 +0,0 @@
1
- # ignore most things, include some others
2
- /*
3
- /.*
4
-
5
- !bin/
6
- !lib/
7
- !docs/
8
- !package.json
9
- !package-lock.json
10
- !README.md
11
- !CONTRIBUTING.md
12
- !LICENSE
13
- !CHANGELOG.md
14
- !example/
15
- !scripts/
16
- !tap-snapshots/
17
- !test/
18
- !.github/
19
- !.travis.yml
20
- !.gitignore
21
- !.gitattributes
22
- !coverage-map.js
23
- !map.js
24
- !index.js
@@ -1,24 +0,0 @@
1
- # ignore most things, include some others
2
- /*
3
- /.*
4
-
5
- !bin/
6
- !lib/
7
- !docs/
8
- !package.json
9
- !package-lock.json
10
- !README.md
11
- !CONTRIBUTING.md
12
- !LICENSE
13
- !CHANGELOG.md
14
- !example/
15
- !scripts/
16
- !tap-snapshots/
17
- !test/
18
- !.github/
19
- !.travis.yml
20
- !.gitignore
21
- !.gitattributes
22
- !coverage-map.js
23
- !map.js
24
- !index.js
@@ -1,24 +0,0 @@
1
- # ignore most things, include some others
2
- /*
3
- /.*
4
-
5
- !bin/
6
- !lib/
7
- !docs/
8
- !package.json
9
- !package-lock.json
10
- !README.md
11
- !CONTRIBUTING.md
12
- !LICENSE
13
- !CHANGELOG.md
14
- !example/
15
- !scripts/
16
- !tap-snapshots/
17
- !test/
18
- !.github/
19
- !.travis.yml
20
- !.gitignore
21
- !.gitattributes
22
- !coverage-map.js
23
- !map.js
24
- !index.js
@@ -1,24 +0,0 @@
1
- # ignore most things, include some others
2
- /*
3
- /.*
4
-
5
- !bin/
6
- !lib/
7
- !docs/
8
- !package.json
9
- !package-lock.json
10
- !README.md
11
- !CONTRIBUTING.md
12
- !LICENSE
13
- !CHANGELOG.md
14
- !example/
15
- !scripts/
16
- !tap-snapshots/
17
- !test/
18
- !.github/
19
- !.travis.yml
20
- !.gitignore
21
- !.gitattributes
22
- !coverage-map.js
23
- !map.js
24
- !index.js