Skip to content

Commit 13d12c6

Browse files
authored
Merge pull request #58 from contentstack/refactor/DX-1103
refactor: change package type module from commonjs
2 parents ee97994 + 3d746d3 commit 13d12c6

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
## Change log
2-
### Version: 4.3.1
3-
#### Date: October-22-2024
1+
### Version: 4.4.0
2+
#### Date: October-21-2024
43
Enh: Node version bump
4+
Refactor: Package type changed to be module instead of CommonJS
55

66
### Version: 4.3.0
77
#### Date: Septmber-09-2024

config/webpack.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
const path = require('path');
1+
import path, { dirname } from 'path';
2+
import { fileURLToPath } from 'url';
23

3-
module.exports = {
4+
// Replicating __dirname in ES modules
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
export default {
49
mode: 'production',
510
entry: './src/index.ts',
611
output: {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/delivery-sdk",
3-
"version": "4.3.1",
4-
"type": "commonjs",
3+
"version": "4.4.0",
4+
"type": "module",
55
"main": "./dist/cjs/src/index.js",
66
"types": "./dist/types/src/index.d.ts",
77
"scripts": {

tools/cleanup.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
const fs = require('fs');
2-
const path = require('path');
1+
import fs from 'fs';
2+
import { fileURLToPath } from 'url';
3+
import path, { dirname } from 'path';
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
37

48
// To remove the relative path
59
function sanitizePath(str) {

0 commit comments

Comments
 (0)