-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #2230 - prevent babel helpers duplication and condense bundle & t…
…ypes (#2278) * fix #2230 * fix linting * improve docsearch-js build process, update all rollup configs, delete some deps
- Loading branch information
1 parent
5142612
commit 29aa9e6
Showing
10 changed files
with
161 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,35 @@ | ||
import replace from '@rollup/plugin-replace'; | ||
|
||
import { plugins } from '../../rollup.base.config'; | ||
import { plugins, typesConfig } from '../../rollup.base.config'; | ||
import { getBundleBanner } from '../../scripts/getBundleBanner'; | ||
|
||
import pkg from './package.json'; | ||
|
||
if (!process.env.BUILD) { | ||
throw new Error('The `BUILD` environment variable is required to build.'); | ||
} | ||
|
||
const output = { | ||
umd: { | ||
file: 'dist/umd/index.js', | ||
format: 'umd', | ||
sourcemap: true, | ||
name: 'docsearch', | ||
banner: getBundleBanner(pkg), | ||
}, | ||
esm: { | ||
file: 'dist/esm/index.js', | ||
format: 'es', | ||
sourcemap: true, | ||
banner: getBundleBanner(pkg), | ||
export default [ | ||
{ | ||
input: 'src/index.ts', | ||
output: [ | ||
{ | ||
file: 'dist/umd/index.js', | ||
format: 'umd', | ||
sourcemap: true, | ||
name: 'docsearch', | ||
banner: getBundleBanner(pkg), | ||
}, | ||
{ | ||
file: 'dist/esm/index.js', | ||
format: 'es', | ||
sourcemap: true, | ||
banner: getBundleBanner(pkg), | ||
plugins: [...plugins], | ||
}, | ||
], | ||
plugins: [ | ||
...plugins, | ||
replace({ | ||
'process.env.NODE_ENV': JSON.stringify('production'), | ||
}), | ||
], | ||
}, | ||
}; | ||
|
||
export default { | ||
input: 'src/index.ts', | ||
output: output[process.env.BUILD], | ||
plugins: | ||
process.env.BUILD === 'umd' | ||
? [ | ||
...plugins, | ||
replace({ | ||
'process.env.NODE_ENV': JSON.stringify('production'), | ||
}), | ||
] | ||
: plugins, | ||
}; | ||
typesConfig, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { DocSearchButton } from './dist/esm/DocSearchButton.js'; | ||
export { DocSearchButton } from './dist/esm'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { DocSearchModal } from './dist/esm/DocSearchModal.js'; | ||
export { DocSearchModal } from './dist/esm'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,34 @@ | ||
import replace from '@rollup/plugin-replace'; | ||
|
||
import { plugins } from '../../rollup.base.config'; | ||
import { plugins, typesConfig } from '../../rollup.base.config'; | ||
import { getBundleBanner } from '../../scripts/getBundleBanner'; | ||
|
||
import pkg from './package.json'; | ||
|
||
export default { | ||
input: 'src/index.ts', | ||
external: ['react', 'react-dom'], | ||
output: { | ||
globals: { | ||
react: 'React', | ||
'react-dom': 'ReactDOM', | ||
}, | ||
file: 'dist/umd/index.js', | ||
format: 'umd', | ||
sourcemap: true, | ||
name: pkg.name, | ||
banner: getBundleBanner(pkg), | ||
export default [ | ||
{ | ||
input: 'src/index.ts', | ||
external: ['react', 'react-dom'], | ||
output: [ | ||
{ | ||
globals: { | ||
react: 'React', | ||
'react-dom': 'ReactDOM', | ||
}, | ||
file: 'dist/umd/index.js', | ||
format: 'umd', | ||
sourcemap: true, | ||
name: pkg.name, | ||
banner: getBundleBanner(pkg), | ||
}, | ||
{ dir: 'dist/esm', format: 'es' }, | ||
], | ||
plugins: [ | ||
...plugins, | ||
replace({ | ||
'process.env.NODE_ENV': JSON.stringify('production'), | ||
}), | ||
], | ||
}, | ||
plugins: [ | ||
...plugins, | ||
replace({ | ||
'process.env.NODE_ENV': JSON.stringify('production'), | ||
}), | ||
], | ||
}; | ||
typesConfig, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.