Skip to content

Commit

Permalink
fix: run preview script (QwikDev#1292)
Browse files Browse the repository at this point in the history
* fix: run preview script

* add export
  • Loading branch information
adamdbradley authored Sep 18, 2022
1 parent c5a262c commit fd30420
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/qwik/src/optimizer/src/plugins/vite-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export async function configurePreviewServer(
) {
const fs: typeof import('fs') = await sys.dynamicImport('fs');

const entryPreviewPaths = ['js', 'mjs', 'cjs'].map((ext) =>
const entryPreviewPaths = ['mjs', 'cjs', 'js'].map((ext) =>
path.join(opts.rootDir, 'server', `entry.preview.${ext}`)
);

Expand Down
6 changes: 5 additions & 1 deletion packages/qwik/src/optimizer/src/plugins/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,11 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
try {
const bundleFileName = sys.path.basename(bundeName);
const ext = sys.path.extname(bundleFileName);
if (bundleFileName.startsWith('entry.') && (ext === '.mjs' || ext === '.cjs')) {
if (
bundleFileName.startsWith('entry.') &&
!bundleFileName.includes('preview') &&
(ext === '.mjs' || ext === '.cjs')
) {
const extlessName = sys.path.basename(bundleFileName, ext);
const js = `${extlessName}.js`;
const moduleName = extlessName + ext;
Expand Down
6 changes: 5 additions & 1 deletion starters/apps/basic/src/routes/flower/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { component$, useClientEffect$, useStore, useStylesScoped$ } from '@builder.io/qwik';
import { useLocation } from '@builder.io/qwik-city';
import { DocumentHead, useLocation } from '@builder.io/qwik-city';
import styles from './flower.css?inline';

export default component$(() => {
Expand Down Expand Up @@ -52,3 +52,7 @@ export default component$(() => {
</>
);
});

export const head: DocumentHead = {
title: 'Qwik Flower',
};

0 comments on commit fd30420

Please sign in to comment.