Skip to content

Commit

Permalink
revert: #6522 & #6526
Browse files Browse the repository at this point in the history
  • Loading branch information
gioboa committed Jun 20, 2024
1 parent 691ca1a commit af7ffe5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 57 deletions.
4 changes: 1 addition & 3 deletions packages/qwik/src/optimizer/src/plugins/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
resolveQwikBuild: true,
transformedModuleOutput: qwikViteOpts.transformedModuleOutput,
vendorRoots: [...(qwikViteOpts.vendorRoots ?? []), ...vendorRoots.map((v) => v.path)],
outDir: viteConfig.build?.assetsDir
? path.join(viteConfig.build?.outDir || CLIENT_OUT_DIR, viteConfig.build?.assetsDir)
: viteConfig.build?.outDir,
outDir: viteConfig.build?.outDir,
devTools: qwikViteOpts.devTools,
sourcemap: !!viteConfig.build?.sourcemap,
lint: qwikViteOpts.lint,
Expand Down
54 changes: 0 additions & 54 deletions packages/qwik/src/optimizer/src/plugins/vite.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,60 +310,6 @@ test('command: serve, --mode ssr', async () => {
assert.deepEqual(opts.resolveQwikBuild, true);
});

test('command: serve, --mode ssr with build.assetsDir', async () => {
const initOpts = {
optimizerOptions: mockOptimizerOptions(),
ssr: {
input: resolve(cwd, 'src', 'renderz.tsx'),
outDir: resolve(cwd, 'ssr-dist'),
},
};
const plugin = qwikVite(initOpts)[0];
const c: any = (await plugin.config(
{ build: { emptyOutDir: true, assetsDir: 'my-assets-dir' } },
{ command: 'serve', mode: 'ssr' }
))!;
const opts = await plugin.api?.getOptions();
const build = c.build!;
const rollupOptions = build!.rollupOptions!;

assert.deepEqual(opts.target, 'ssr');
assert.deepEqual(opts.buildMode, 'development');
assert.deepEqual(build.minify, undefined);
assert.deepEqual(build.ssr, undefined);
assert.deepEqual(rollupOptions.input, [normalizePath(resolve(cwd, 'src', 'renderz.tsx'))]);
assert.deepEqual(c.build.outDir, normalizePath(resolve(cwd, 'ssr-dist')));
assert.deepEqual(build.emptyOutDir, undefined);
assert.deepEqual(c.publicDir, undefined);
assert.deepEqual(opts.resolveQwikBuild, true);
});

test('should use build.assetsDir config with dist/ fallback', async () => {
const initOpts = {
optimizerOptions: mockOptimizerOptions(),
};
const plugin = qwikVite(initOpts)[0];
const c: any = (await plugin.config(
{ build: { assetsDir: 'my-assets-dir/' } },
{ command: 'serve', mode: 'ssr' }
))!;

assert.equal(c.build.outDir, normalizePath(resolve(cwd, `dist/my-assets-dir`)));
});

test('should use build.outDir and build.assetsDir config ', async () => {
const initOpts = {
optimizerOptions: mockOptimizerOptions(),
};
const plugin = qwikVite(initOpts)[0];
const c: any = (await plugin.config(
{ build: { outDir: 'my-dist/', assetsDir: 'my-assets-dir' } },
{ command: 'serve', mode: 'ssr' }
))!;

assert.equal(c.build.outDir, normalizePath(resolve(cwd, `my-dist/my-assets-dir`)));
});

test('command: build, --mode lib', async () => {
const initOpts = {
optimizerOptions: mockOptimizerOptions(),
Expand Down

0 comments on commit af7ffe5

Please sign in to comment.