Skip to content

Commit

Permalink
fix: vite react plugin (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat authored Jun 29, 2022
1 parent 9e76276 commit 622721c
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "qwik-monorepo",
"version": "0.0.32",
"version": "0.0.33",
"scripts": {
"build": "yarn node scripts --tsc --build --api --platform-binding-wasm-copy",
"build.full": "yarn node scripts --tsc --build --api --eslint --qwikcity --qwikreact --platform-binding --wasm",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-qwik/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-qwik",
"version": "0.0.32",
"version": "0.0.33",
"description": "Interactive CLI and API for generating Qwik projects.",
"bin": "create-qwik",
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-qwik/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-qwik",
"version": "0.0.32",
"version": "0.0.33",
"description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.",
"main": "index.js",
"author": "Builder Team",
Expand Down
2 changes: 2 additions & 0 deletions packages/qwik-react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export { qwikify$, qwikifyQrl } from './react/qwikify';
export { renderToString } from './server/index';
export { qwikReact } from './vite/index';

export type { QwikifyCmp, QwikifyProps } from './react/qwikify';
19 changes: 19 additions & 0 deletions packages/qwik-react/src/vite/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export function qwikReact(): any {
const OPTIMIZE_DEPS = ['react', 'react-dom/client', 'hoist-non-react-statics', '@emotion/react'];

const DEDUPE = ['react', 'react-dom', '@emotion/react'];

return {
name: 'vite-plugin-qwik-react',
config() {
return {
resolve: {
dedupe: DEDUPE,
},
optimizeDeps: {
include: OPTIMIZE_DEPS,
},
};
},
};
}
2 changes: 1 addition & 1 deletion packages/qwik/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@builder.io/qwik",
"version": "0.0.32",
"version": "0.0.33",
"description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.",
"main": "./dist/core.cjs",
"module": "./dist/core.mjs",
Expand Down
11 changes: 2 additions & 9 deletions packages/qwik/src/optimizer/src/plugins/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,9 @@ import { createRollupError, normalizeRollupOutputOptions } from './rollup';
import { QWIK_LOADER_DEFAULT_DEBUG, QWIK_LOADER_DEFAULT_MINIFIED } from '../scripts';
import { versions } from '../versions';

const OPTIMIZE_DEPS = [
QWIK_CORE_ID,
QWIK_JSX_RUNTIME_ID,
'react',
'react-dom/client',
'hoist-non-react-statics',
'@emotion/react',
];
const OPTIMIZE_DEPS = [QWIK_CORE_ID, QWIK_JSX_RUNTIME_ID];

const DEDUPE = [QWIK_CORE_ID, QWIK_JSX_RUNTIME_ID, 'react', 'react-dom', '@emotion/react'];
const DEDUPE = [QWIK_CORE_ID, QWIK_JSX_RUNTIME_ID];

/**
* @alpha
Expand Down
9 changes: 1 addition & 8 deletions packages/qwik/src/optimizer/src/plugins/vite.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ describe('vite plugin', () => {
};
});

const deps = [
'@builder.io/qwik',
'@builder.io/qwik/jsx-runtime',
'react',
'react-dom/client',
'hoist-non-react-statics',
'@emotion/react',
];
const deps = ['@builder.io/qwik', '@builder.io/qwik/jsx-runtime'];

describe('config', () => {
it('command: serve, mode: development', async () => {
Expand Down

0 comments on commit 622721c

Please sign in to comment.