diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c6e7c7b..167c07be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ -## Change log -### Version: 4.3.1 -#### Date: October-22-2024 +### Version: 4.4.0 +#### Date: October-21-2024 Enh: Node version bump +Refactor: Package type changed to be module instead of CommonJS ### Version: 4.3.0 #### Date: Septmber-09-2024 diff --git a/config/webpack.config.js b/config/webpack.config.js index 08346193..ad436696 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -1,6 +1,11 @@ -const path = require('path'); +import path, { dirname } from 'path'; +import { fileURLToPath } from 'url'; -module.exports = { +// Replicating __dirname in ES modules +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +export default { mode: 'production', entry: './src/index.ts', output: { diff --git a/package.json b/package.json index 6450c58a..39860b4d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/delivery-sdk", - "version": "4.3.1", - "type": "commonjs", + "version": "4.4.0", + "type": "module", "main": "./dist/cjs/src/index.js", "types": "./dist/types/src/index.d.ts", "scripts": { diff --git a/tools/cleanup.js b/tools/cleanup.js index 3f1abc78..d3fa4052 100644 --- a/tools/cleanup.js +++ b/tools/cleanup.js @@ -1,5 +1,9 @@ -const fs = require('fs'); -const path = require('path'); +import fs from 'fs'; +import { fileURLToPath } from 'url'; +import path, { dirname } from 'path'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); // To remove the relative path function sanitizePath(str) {