Skip to content

Commit 59584c3

Browse files
authored
chore(build): Set "type": "commonjs" in dist/package.json (#8097)
Set "type": "commonjs" in the generated dist/package.json file, since the .js files in the package root are CJS. This should be a no-op since that's the default, but by setting it explicitly we ensure that any change to the repository top-level package.json to set "type": "module" won't break the published package accidentally.
1 parent c029865 commit 59584c3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

scripts/gulpfiles/package_tasks.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ function packageJSON(done) {
178178
const json = JSON.parse(JSON.stringify(getPackageJson()));
179179
// Remove unwanted entries.
180180
delete json['scripts'];
181+
// Set "type": "commonjs", since that's what .js files in the
182+
// package root are. This should be a no-op since that's the
183+
// default, but by setting it explicitly we ensure that any chage to
184+
// the repository top-level package.json to set "type": "module"
185+
// won't break the published package accidentally.
186+
json.type = 'commonjs';
181187
// Write resulting package.json file to release directory.
182188
if (!fs.existsSync(RELEASE_DIR)) {
183189
fs.mkdirSync(RELEASE_DIR, {recursive: true});

0 commit comments

Comments
 (0)