Skip to content

Commit b46bf16

Browse files
authored
fix: vite (#171)
1 parent 2640fcc commit b46bf16

File tree

11 files changed

+32
-27
lines changed

11 files changed

+32
-27
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@builder.io/qwik",
3-
"version": "0.0.16-9",
3+
"version": "0.0.16-10",
44
"description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.",
55
"scripts": {
66
"build": "node scripts --tsc --build --api --platform-binding --wasm",

src/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-qwik",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"description": "Interactive CLI and API for generating Qwik projects.",
55
"bin": {
66
"create-qwik": "create-qwik"

src/optimizer/src/rollup/index.ts

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ export function qwikRollup(opts: QwikPluginOptions): any {
4141
}
4242
return {
4343
esbuild: { include: /\.js$/ },
44+
optimizeDeps: {
45+
include: ['@builder.io/qwik', '@builder.io/qwik/jsx-runtime'],
46+
},
4447
build: {
4548
polyfillModulePreload: false,
4649
dynamicImportVarsOptions: {
@@ -128,8 +131,7 @@ export function qwikRollup(opts: QwikPluginOptions): any {
128131

129132
const result = await optimizer.transformFs(transformOpts);
130133
for (const output of result.modules) {
131-
let key = optimizer.path.join(transformOpts.rootDir, output.path)!;
132-
key = key.split('.').slice(0, -1).join('.');
134+
const key = optimizer.path.join(transformOpts.rootDir, output.path)!;
133135
if (debug) {
134136
// eslint-disable-next-line no-console
135137
console.debug(`[QWIK PLUGIN] Module: ${key}`);
@@ -166,24 +168,23 @@ export function qwikRollup(opts: QwikPluginOptions): any {
166168
id = optimizer.path.resolve(dir, id);
167169
}
168170
}
169-
if (transformedOutputs.has(id)) {
170-
if (debug) {
171-
// eslint-disable-next-line no-console
172-
console.debug(`[QWIK PLUGIN] Resolve: ${id} ${opts}`);
173-
}
174-
return {
175-
id,
176-
moduleSideEffects: false,
177-
};
171+
const tries = [id, id + '.js'];
172+
if (['.jsx', '.ts', '.tsx'].includes(optimizer.path.extname(id))) {
173+
tries.push(removeExtension(id) + '.js');
178174
}
179-
if (['.js', '.jsx', '.ts', '.tsx'].includes(optimizer.path.extname(id))) {
180-
id = id.split('.').slice(0, -1).join('.');
181-
if (transformedOutputs.has(id)) {
175+
for (const id of tries) {
176+
const res = transformedOutputs.get(id);
177+
if (res) {
182178
if (debug) {
183179
// eslint-disable-next-line no-console
184-
console.debug(`[QWIK PLUGIN] Resolved: ${id}`);
180+
console.debug(`[QWIK PLUGIN] Resolve: ${id} ${opts}`);
185181
}
186-
return id;
182+
const mod = res[0];
183+
const sideEffects = !mod.isEntry || !mod.hook;
184+
return {
185+
id,
186+
moduleSideEffects: sideEffects,
187+
};
187188
}
188189
}
189190
return null;
@@ -310,7 +311,7 @@ export function qwikRollup(opts: QwikPluginOptions): any {
310311

311312
hooks.forEach((h) => {
312313
const symbolName = h.name;
313-
let filename = h.canonicalFilename;
314+
let filename = h.canonicalFilename + '.js';
314315
// eslint-disable-next-line
315316
const found = output.find(([_, v]) => {
316317
return (
@@ -344,6 +345,10 @@ export function qwikRollup(opts: QwikPluginOptions): any {
344345
return plugin;
345346
}
346347

348+
function removeExtension(id: string) {
349+
return id.split('.').slice(0, -1).join('.');
350+
}
351+
347352
/**
348353
* @alpha
349354
*/

starters/apps/e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dev": "vite"
1111
},
1212
"devDependencies": {
13-
"@builder.io/qwik": "0.0.16-9",
13+
"@builder.io/qwik": "0.0.16-10",
1414
"typescript": "^4.5.2",
1515
"vite": "2.7.13"
1616
},

starters/apps/starter-builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dev": "vite"
1111
},
1212
"devDependencies": {
13-
"@builder.io/qwik": "0.0.16-9",
13+
"@builder.io/qwik": "0.0.16-10",
1414
"typescript": "^4.5.2",
1515
"vite": "2.7.13"
1616
},

starters/apps/starter-partytown/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dev": "vite"
1111
},
1212
"devDependencies": {
13-
"@builder.io/qwik": "0.0.16-9",
13+
"@builder.io/qwik": "0.0.16-10",
1414
"typescript": "4.5.2",
1515
"vite": "2.7.13"
1616
},

starters/apps/starter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dev": "vite"
1111
},
1212
"devDependencies": {
13-
"@builder.io/qwik": "0.0.16-9",
13+
"@builder.io/qwik": "0.0.16-10",
1414
"typescript": "^4.5.2",
1515
"vite": "2.7.13"
1616
},

starters/apps/todo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dev": "vite"
1111
},
1212
"devDependencies": {
13-
"@builder.io/qwik": "0.0.16-9",
13+
"@builder.io/qwik": "0.0.16-10",
1414
"typescript": "^4.5.2",
1515
"vite": "2.7.13"
1616
},

starters/dev-server.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function removeDir(dir) {
141141
async function ssrApp(req, appName, appDir) {
142142
const buildDir = join(appDir, 'build');
143143
const serverDir = join(buildDir, 'server');
144-
const serverPath = join(serverDir, 'entry.js');
144+
const serverPath = join(serverDir, 'entry.server.js');
145145
const symbolsPath = join(serverDir, 'q-symbols.json');
146146
const symbols = JSON.parse(readFileSync(symbolsPath, 'utf-8'));
147147

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name": "cloudflare-worker",
3-
"main": "build/entry.js"
3+
"main": "build/entry.cloudflare.js"
44
}

0 commit comments

Comments
 (0)