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

Add pre-configured code transform + Replace Vite Library Mode by raw Rollup #47

Merged
merged 11 commits into from
Apr 15, 2022

Conversation

nvh95
Copy link
Owner

@nvh95 nvh95 commented Apr 14, 2022

Features

  • Add pre-configured code transforms for css, file and fileCRA. Users don't need to update the configs when we ship a feature that requires adjusting the config.
transform: {
-  '^.+\\.css$': '<rootDir>/config/jest/cssTransform.js',
+  '^.+\\.css$': '<rootDir>/transforms/css',
-  '^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|json)$)': '<rootDir>/config/jest/fileTransform.js',
+  '^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|json)$)': '<rootDir>/transforms/file',
},
  • Use Rollup instead of Vite Library Mode since Vite doesn't handle multiple entries well. I tried to overwrite Vite's build.lib config with rollupOptions but it doesn't work (and very bad DX). So I switch to rollup to meet jest-preview's need.
-"build::only": "vite build",
+"build:legacy::only": "vite build",
-"build:watch": "vite build --watch",
+"build:legacy:watch": "vite build --watch",

@nvh95 nvh95 requested a review from ntt261298 April 14, 2022 15:09
@nvh95 nvh95 linked an issue Apr 14, 2022 that may be closed by this pull request
{
"transform": {
// Other transforms
"^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": "jest-preview/transforms/file"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be jest-preview/transforms/fileCRA

{
"transform": {
// Other transforms
"^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": "jest-preview/transforms/file"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be jest-preview/transforms/fileCRA right?

@ntt261298 ntt261298 merged commit b4c848d into main Apr 15, 2022
@ntt261298 ntt261298 deleted the pre-config branch April 15, 2022 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase DX by providing pre-configured transformers
2 participants