Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React 18 #81

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
30 changes: 8 additions & 22 deletions js_src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,17 @@
"module": "src/_react-testing-library.js",
"prodBundle": "../lib/js/react-testing-library.js",
"scripts": {
"build": "yarn build:bundle",
"build:bundle": "rollup -c"
"build": "vite build",
"build:bundle": "vite build"
},
"dependencies": {
"core-js": "3",
"@testing-library/dom": "^7.30.0",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^13.5.0",
"react": "^17.0.0",
"react-dom": "^17.0.0"
"@testing-library/dom": "^8.0.0",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.1.9",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@babel/cli": "^7.12.13",
"@babel/core": "^7.12.13",
"@babel/plugin-transform-runtime": "^7.12.15",
"@babel/preset-env": "^7.12.13",
"@babel/preset-typescript": "^7.12.13",
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"@rollup/plugin-babel": "^5.2.3",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.1.1",
"rollup": "^2.38.5",
"rollup-plugin-filesize": "^9.1.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0"
"vite": "^5.4.9"
}
}
77 changes: 0 additions & 77 deletions js_src/rollup.config.js

This file was deleted.

42 changes: 42 additions & 0 deletions js_src/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { resolve, dirname, parse } from 'path';
import { defineConfig } from 'vite';
import pkg from './package.json' assert { type: 'json' };

const input = 'src/_react-testing-library.js';
const jsPackageName = 'rtl';

const globals = {
react: 'React',
'react-dom': 'ReactDOM',
};

export default defineConfig({
define: {
'process.env.NODE_ENV': JSON.stringify('production'),
},
build: {
emptyOutDir: true,
outDir: dirname(pkg.prodBundle),
lib: {
// Could also be a dictionary or array of multiple entry points
entry: input,
name: jsPackageName,
// the proper extensions will be added
fileName: parse(pkg.prodBundle).name,
formats: ['umd'],
},
minify: false,
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: Object.keys(globals),
output: {
// This is the output filename
entryFileNames: `${parse(pkg.prodBundle).name}.js`,
// Provide global variables to use in the UMD build
// for externalized deps
globals: globals,
},
},
},
});
Loading