Download react-hook-form/scripts/rollup/createRollupConfig.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/scripts/rollup/createRollupConfig.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/scripts/rollup/createRollupConfig.js
-
curl -L -o createRollupConfig.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/scripts/rollup/createRollupConfig.js
1.34 kB
| import commonjs from '@rollup/plugin-commonjs'; | |
| import terser from '@rollup/plugin-terser'; | |
| import typescript from 'rollup-plugin-typescript2'; | |
| import pkg from '../../package.json'; | |
| /** | |
| * | |
| * @returns {import("rollup").RollupOptions} | |
| */ | |
| export function createRollupConfig(options, callback) { | |
| const name = options.name; | |
| // A file with the extension ".mjs" will always be treated as ESM, even when pkg.type is "commonjs" (the default) | |
| // https://nodejs.org/docs/latest/api/packages.html#packages_determining_module_system | |
| const extName = options.format === 'esm' ? 'mjs' : 'js'; | |
| const outputName = 'dist/' + [name, options.format, extName].join('.'); | |
| const config = { | |
| input: options.input, | |
| output: { | |
| file: outputName, | |
| format: options.format, | |
| name: 'ReactHookForm', | |
| sourcemap: true, | |
| globals: { react: 'React' }, | |
| exports: 'named', | |
| }, | |
| external: Object.keys(pkg.peerDependencies), | |
| plugins: [ | |
| typescript({ | |
| clean: true, | |
| }), | |
| options.format === 'umd' && | |
| commonjs({ | |
| include: /\/node_modules\//, | |
| }), | |
| options.format !== 'esm' && | |
| terser({ | |
| output: { comments: false }, | |
| compress: { drop_console: true }, | |
| }), | |
| ].filter(Boolean), | |
| }; | |
| return callback ? callback(config) : config; | |
| } | |