Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:privatenumber/esbuild-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Jan 13, 2023
2 parents 08cce3d + 270cda4 commit 9ca739e
Show file tree
Hide file tree
Showing 28 changed files with 2,471 additions and 5,397 deletions.
9 changes: 1 addition & 8 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,8 @@ body:
attributes:
label: Environment
description: |
Describe the environment the issue is happening in. This information is used to for reproduction and debugging.
Describe the environment the issue is happening in. This information is used to for reproduction and debugging. Run and paste the output of: `npx envinfo --system --npmPackages webpack,esbuild-loader --binaries`.
placeholder: |
<!--
Run and paste the output of:
```
npx envinfo --system --npmPackages webpack,esbuild-loader --binaries
```
-->
System:
OS:
CPU:
Expand Down
32 changes: 24 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,35 @@ jobs:
name: Release
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Install dependencies
run: npx ci
node-version-file: '.nvmrc'

- name: Setup pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7
run_install: true

- name: Build
run: pnpm build

- name: Test
run: npm run test
env:
NODE_OPTIONS: --openssl-legacy-provider
run: pnpm test

- name: Lint
run: pnpm lint

- name: Release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
run: pnpm dlx semantic-release
38 changes: 25 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,32 @@ jobs:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node-version: [10.x, 16.x]

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npx ci
- name: Lint
if: ${{ matrix.node-version == '14.x' }}
run: npm run lint
node-version-file: '.nvmrc'

- name: Setup pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7
run_install: true

- name: Build
run: pnpm build

- name: Test
run: npm run test --if-present
env:
NODE_OPTIONS: --openssl-legacy-provider
run: pnpm test

- name: Test Node.js v12
run: pnpm --use-node-version=12.22.12 test

- name: Lint
run: pnpm lint
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ node_modules/
# Output of 'npm pack'
*.tgz

# Jest coverage data
coverage

# Distribution files
dist

# Cache
.eslintcache
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12.19.0
v18.13.0
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ Alternatively, you can also pass it in directly via the [`tsconfigRaw` option](h
⚠️ esbuild only supports a subset of `tsconfig` options [(see `TransformOptions` interface)](https://github.com/evanw/esbuild/blob/88821b7e7d46737f633120f91c65f662eace0bcf/lib/shared/types.ts#L159-L165) and does not do type-checks. It's recommended to use a type-aware IDE or `tsc --noEmit` for type-checking instead. It is also recommended to enable [`isolatedModules`](https://www.typescriptlang.org/tsconfig#isolatedModules) and [`esModuleInterop`](https://www.typescriptlang.org/tsconfig/#esModuleInterop) options in your `tsconfig` by the [esbuild docs](https://esbuild.github.io/content-types/#typescript-caveats).


#### `tsconfig.json` Paths
Use [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin) to add support for `tsconfig.json#paths`.

Since esbuild-loader only uses esbuild to transform code, it cannot help Webpack with resolving [tsconfig.json#paths](https://www.typescriptlang.org/tsconfig/paths.html).


### JS Minification (eg. Terser)
You can replace JS minifiers like Terser or UglifyJs. Checkout the [benchmarks](https://github.com/privatenumber/minification-benchmarks) to see how much faster esbuild is. The `target` option tells esbuild that it can use newer JS syntax to perform better minification.

Expand Down Expand Up @@ -336,7 +342,7 @@ Type: `boolean`
Minify JS using equivalent but shorter syntax.

#### legalComments
Type: `'none' | 'inline' | 'eof'`
Type: `'none' | 'inline' | 'eof' | 'external'`

Default: `'inline'`

Expand Down Expand Up @@ -415,11 +421,13 @@ Consider these type-checking alternatives:
- Running `tsc --noEmit` to type check
- Integrating type-checking to your Webpack build as a separate process using [`fork-ts-checker-webpack-plugin`](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin)

## 🌱 Other Webpack plugins
## 💞 Related

#### [tsx](https://github.com/esbuild-kit/tsx)
Node.js enhanced with esbuild to run TypeScript and ESM.

#### [instant-mocha](https://github.com/privatenumber/instant-mocha)
Webpack-integrated Mocha test-runner with Webpack 5 support.


#### [webpack-localize-assets-plugin](https://github.com/privatenumber/webpack-localize-assets-plugin)
Localize/i18nalize your Webpack build. Optimized for multiple locales!
6 changes: 0 additions & 6 deletions jest.config.js

This file was deleted.

43 changes: 25 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,46 @@
],
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"imports": {
"#esbuild-loader": {
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./dist/index.js"
}
},
"scripts": {
"build": "tsc",
"pretest": "npm run build",
"test": "jest --coverage",
"lint": "eslint ."
"test": "tsx tests",
"dev": "tsx watch --conditions=development tests",
"lint": "eslint --cache ."
},
"peerDependencies": {
"webpack": "^4.40.0 || ^5.0.0"
},
"dependencies": {
"esbuild": "^0.15.6",
"esbuild": "^0.16.17",
"joycon": "^3.0.1",
"json5": "^2.2.0",
"loader-utils": "^2.0.0",
"tapable": "^2.2.0",
"webpack-sources": "^2.2.0"
"webpack-sources": "^1.4.3"
},
"devDependencies": {
"@pvtnbr/eslint-config": "^0.26.2",
"@types/jest": "^27.0.3",
"@pvtnbr/eslint-config": "^0.33.0",
"@types/loader-utils": "^2.0.3",
"@types/node": "^18.0.4",
"@types/webpack": "^4.41.32",
"@types/webpack-sources": "^3.2.0",
"css-loader": "^5.2.0",
"eslint": "^8.19.0",
"jest": "^27.4.4",
"memfs": "^3.4.0",
"mini-css-extract-plugin": "^1.4.0",
"typescript": "^4.7.4",
"unionfs": "^4.4.0",
"@types/mini-css-extract-plugin": "^2.5.1",
"@types/node": "^18.11.18",
"@types/webpack": "^4.41.33",
"@types/webpack-sources": "^0.1.9",
"css-loader": "^5.2.7",
"eslint": "^8.31.0",
"manten": "^0.6.0",
"memfs": "^3.4.13",
"mini-css-extract-plugin": "^1.6.2",
"tsx": "^3.12.2",
"typescript": "^4.9.4",
"webpack": "^4.44.2",
"webpack-test-utils": "^1.1.0",
"webpack-test-utils": "^2.1.0",
"webpack5": "npm:webpack@^5.0.0"
},
"eslintConfig": {
Expand Down
Loading

0 comments on commit 9ca739e

Please sign in to comment.