Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .babelrc

This file was deleted.

131 changes: 0 additions & 131 deletions .eslintrc

This file was deleted.

8 changes: 3 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ jobs:
strategy:
matrix:
node-version:
- 14
- 16
- 18
- 20
- 22
command:
- lint
- test
Expand All @@ -30,6 +28,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: |
yarn install
npm install
- run: |
yarn ${{ matrix.command }}
npm ${{ matrix.command }}
6 changes: 4 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
src
test
webpack.config.babel.js
.env
.env.sample
.travis.yml
.circleci
.gitignore
esbuild.js
eslint.config.mjs
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: node_js
node_js:
- 10
- 14
- 22
cache:
directories:
- node_modules
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ s3Options: {

##### Require `webpack-s3-plugin`
```javascript
var S3Plugin = require('webpack-s3-plugin')
// Supports ESM & CJS
const S3Plugin = require('webpack-s3-plugin')
import S3Plugin from 'webpack-s3-plugin'
```

##### With exclude
Expand Down
44 changes: 44 additions & 0 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import esbuild from 'esbuild'
import {nodeExternalsPlugin} from 'esbuild-node-externals'
import {rm} from 'fs/promises'

try {
// Delete the dist directory before building
await rm('./dist', {recursive: true, force: true})
} catch (error) {
// Ignore errors if directory doesn't exist
if (error.code !== 'ENOENT') {
// eslint-disable-next-line no-console
console.error('Error cleaning up build files:', error)
}
}

const opts = {
entryPoints:['./src/s3_plugin.js'],
bundle: true,
platform: 'node',
target: 'node20',
}

const builds = [
{
outfile: 'dist/s3_plugin.cjs',
format: 'cjs',
plugins: [nodeExternalsPlugin({
// mime module is ESM only so we need to include it for CJS bundle to work
allowList: [/mime.*/]
})],
},
{
outfile: 'dist/s3_plugin.mjs',
format: 'esm',
plugins: [nodeExternalsPlugin()],
}
]

for (const build of builds) {
esbuild.build({
...opts,
...build
}).catch(() => process.exit(1))
}
Loading