Skip to content

Commit

Permalink
[web components]: Remove babel/preset-env from build step (#11945)
Browse files Browse the repository at this point in the history
### Related Ticket(s)

Closes #11944
[ADCMS-5513](https://jsw.ibm.com/browse/ADCMS-5513)

### Description

Removes `@babel/preset-env` from the babel configuration for the `build:modules:scripts` gulp task that is responsible for transpiling modules into the `es/` directory for distribution. This seems to have slipped in by mistake (see [issue description](#11944) for details) and leads to bloated transpiled modules, as the targets for `@babel/preset-env` are undefined leading to transpiling for the lowest common denominator of browser support.

The fix here puts the `@carbon/ibmdotcom-web-components` build script inline with the CWC build script, removing `@babel/preset-env`.

### Changelog

**Changed**

- Updated `strip-comments` to `^2.0.1`

**Removed**

- Removed `@babel/preset-env` from the `build:modules:scripts` gulp task

<!-- React and Web Component deploy previews are enabled by default. -->
<!-- To enable additional available deploy previews, apply the following -->
<!-- labels for the corresponding package: -->
<!-- *** "test: e2e": Codesandbox examples and e2e integration tests -->
<!-- *** "package: services": Services -->
<!-- *** "package: utilities": Utilities -->
<!-- *** "RTL": React / Web Components (RTL) -->
<!-- *** "feature flag": React / Web Components (experimental) -->
  • Loading branch information
m4olivei committed Jul 31, 2024
1 parent a8f49a8 commit 562d803
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 42 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/carbon-web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"rollup-plugin-multi-input": "^1.3.1",
"sass": "~1.77.0",
"sass-loader": "^10.0.0",
"strip-comments": "^1.0.0",
"strip-comments": "^2.0.1",
"style-loader": "^2.0.0",
"temp": "^0.9.0",
"terser-webpack-plugin": "^4.2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/services-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"jest-circus": "25.5.4",
"jest-fetch-mock": "^3.0.0",
"redux-mock-store": "^1.5.0",
"strip-comments": "^1.0.0",
"strip-comments": "^2.0.1",
"through2": "^3.0.0",
"typescript": "^5.2.2"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/web-components/gulp-tasks/build/modules/scripts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license
*
* Copyright IBM Corp. 2020, 2023
* Copyright IBM Corp. 2020, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -36,7 +36,7 @@ function scripts() {
.pipe(sourcemaps.init())
.pipe(
babel({
presets: ['@babel/preset-modules', '@babel/preset-env'],
presets: ['@babel/preset-modules'],
// `version: '7.3.0'` ensures `@babel/plugin-transform-runtime` is applied to decorator helper
plugins: [
[
Expand All @@ -50,7 +50,7 @@ function scripts() {
)
// Avoids generating `.js` from interface-only `.ts` files
.pipe(
filter(file =>
filter((file) =>
stripComments(file.contents.toString(), {
sourceType: 'module',
}).replace(/\s/g, '')
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"rollup-plugin-sizes": "^1.0.4",
"sass-loader": "^10.0.0",
"storybook-addon-rtl": "^0.5.0",
"strip-comments": "^1.0.0",
"strip-comments": "^2.0.1",
"style-loader": "^2.0.0",
"svgo": "^1.3.0",
"temp": "^0.9.0",
Expand Down
43 changes: 7 additions & 36 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3310,7 +3310,7 @@ __metadata:
redux-logger: "npm:^3.0.0"
redux-mock-store: "npm:^1.5.0"
redux-thunk: "npm:^2.3.0"
strip-comments: "npm:^1.0.0"
strip-comments: "npm:^2.0.1"
through2: "npm:^3.0.0"
typescript: "npm:^5.2.2"
window-or-global: "npm:^1.0.1"
Expand Down Expand Up @@ -3598,7 +3598,7 @@ __metadata:
rollup-plugin-sizes: "npm:^1.0.4"
sass-loader: "npm:^10.0.0"
storybook-addon-rtl: "npm:^0.5.0"
strip-comments: "npm:^1.0.0"
strip-comments: "npm:^2.0.1"
style-loader: "npm:^2.0.0"
svgo: "npm:^1.3.0"
temp: "npm:^0.9.0"
Expand Down Expand Up @@ -3928,7 +3928,7 @@ __metadata:
rollup-plugin-multi-input: "npm:^1.3.1"
sass: "npm:~1.77.0"
sass-loader: "npm:^10.0.0"
strip-comments: "npm:^1.0.0"
strip-comments: "npm:^2.0.1"
style-loader: "npm:^2.0.0"
temp: "npm:^0.9.0"
terser-webpack-plugin: "npm:^4.2.3"
Expand Down Expand Up @@ -10653,15 +10653,6 @@ __metadata:
languageName: node
linkType: hard

"babel-extract-comments@npm:^1.0.0":
version: 1.0.0
resolution: "babel-extract-comments@npm:1.0.0"
dependencies:
babylon: "npm:^6.18.0"
checksum: 10/6345c688ccb56a7b750223afb42c1ddc83865b8ac33d7b808b5ad5e3619624563cf8324fbacdcf41cf073a40d935468a05f806e1a7622b0186fa5dad1232a07b
languageName: node
linkType: hard

"babel-generator@npm:^6.18.0":
version: 6.26.1
resolution: "babel-generator@npm:6.26.1"
Expand Down Expand Up @@ -11050,13 +11041,6 @@ __metadata:
languageName: node
linkType: hard

"babel-plugin-syntax-object-rest-spread@npm:^6.8.0":
version: 6.13.0
resolution: "babel-plugin-syntax-object-rest-spread@npm:6.13.0"
checksum: 10/14083f2783c760f5f199160f48e42ad4505fd35fc7cf9c4530812b176705259562b77db6d3ddc5e3cbce9e9b2b61ec9db3065941f0949b68e77cae3e395a6eef
languageName: node
linkType: hard

"babel-plugin-template-html-minifier@npm:^4.1.0":
version: 4.1.0
resolution: "babel-plugin-template-html-minifier@npm:4.1.0"
Expand All @@ -11068,16 +11052,6 @@ __metadata:
languageName: node
linkType: hard

"babel-plugin-transform-object-rest-spread@npm:^6.26.0":
version: 6.26.0
resolution: "babel-plugin-transform-object-rest-spread@npm:6.26.0"
dependencies:
babel-plugin-syntax-object-rest-spread: "npm:^6.8.0"
babel-runtime: "npm:^6.26.0"
checksum: 10/d14bd4a90edaabab5d3466fa235553fc29cc2b1c2e78a0454c4509d3364451de75cd8bbd84124e01a13bde80d7292decc22f617b0e4f567bf30cd4ac9d2cecfa
languageName: node
linkType: hard

"babel-polyfill@npm:^6.26.0":
version: 6.26.0
resolution: "babel-polyfill@npm:6.26.0"
Expand Down Expand Up @@ -33030,13 +33004,10 @@ __metadata:
languageName: node
linkType: hard

"strip-comments@npm:^1.0.0":
version: 1.0.2
resolution: "strip-comments@npm:1.0.2"
dependencies:
babel-extract-comments: "npm:^1.0.0"
babel-plugin-transform-object-rest-spread: "npm:^6.26.0"
checksum: 10/494b2e4456908aad0d6aa2bddc304a2d7cded274046663f2ff9619808ecc41fef482dffad0b4a6147c965e874500d36b2ed6eefea9666722b7a53dba40f69876
"strip-comments@npm:^2.0.1":
version: 2.0.1
resolution: "strip-comments@npm:2.0.1"
checksum: 10/43ea36189e4ba543c6ffb0384831e9e23c3b57ede5592c6edcbfc883f489f91d00328fe2670b4e467f61c7886eff68deae3e946f0f092346b2b3cb058b9cfdba
languageName: node
linkType: hard

Expand Down

0 comments on commit 562d803

Please sign in to comment.