Skip to content

Commit b4ed187

Browse files
authored
feat(instantsearch-ui-components): update build (#6037)
1 parent 9afbaec commit b4ed187

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

babel.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,19 @@ module.exports = (api) => {
121121
],
122122
],
123123
},
124+
{
125+
test: 'packages/instantsearch-ui-components',
126+
plugins: [
127+
[
128+
'@babel/plugin-transform-runtime',
129+
{
130+
corejs: false,
131+
helpers: true,
132+
regenerator: false,
133+
},
134+
],
135+
],
136+
},
124137
],
125138
// jsx is transpiled, so the comment should no longer be present in the final files
126139
shouldPrintComment: (value) => value !== '* @jsx h ',

packages/instantsearch-ui-components/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
"description": "Common UI components for InstantSearch.",
55
"source": "src/index.ts",
66
"types": "dist/es/index.d.ts",
7-
"main": "dist/es/index.js",
7+
"main": "dist/cjs/index.js",
88
"module": "dist/es/index.js",
99
"type": "module",
1010
"exports": {
1111
"types": "./dist/es/index.d.ts",
12+
"require": "./dist/cjs/index.js",
1213
"default": "./dist/es/index.js"
1314
},
1415
"sideEffects": false,
@@ -38,8 +39,9 @@
3839
],
3940
"scripts": {
4041
"clean": "rm -rf dist",
41-
"build": "yarn build:es && yarn build:types",
42+
"build": "yarn build:cjs && yarn build:es && yarn build:types",
4243
"build:es": "BABEL_ENV=es babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/es --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet",
44+
"build:cjs": "BABEL_ENV=cjs babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/cjs --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet && ../../scripts/prepare-cjs.sh",
4345
"build:types": "tsc -p ./tsconfig.declaration.json --outDir ./dist/es",
4446
"version": "./scripts/version.cjs"
4547
}

packages/instantsearch.js/scripts/rollup/rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const plugins = [
2323
}),
2424
babel({
2525
rootMode: 'upward',
26+
runtimeHelpers: true,
2627
exclude: /node_modules|algoliasearch-helper/,
2728
extensions: ['.js', '.ts', '.tsx'],
2829
}),

0 commit comments

Comments
 (0)