Skip to content

Commit

Permalink
chore: optimize compiler define
Browse files Browse the repository at this point in the history
  • Loading branch information
ErKeLost committed Oct 8, 2024
1 parent 202aed4 commit f510fbf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/vue3/farm.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function myCustomPlugin() {
apply: "serve",
config(config, { command }) {},
configureServer(server) {
console.log(server.moduleGraph.getModuleById);
// console.log(server.moduleGraph.getModuleById);
},
transformIndexHtml(c) {
return c.replace(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/compiler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class Compiler {
constructor(public config: ResolvedUserConfig) {
this._bindingCompiler = new BindingCompiler({
// @ts-ignore
config: { ...config.compilation, ...config.config },
config: config.compilation,
jsPlugins: config.jsPlugins,
rustPlugins: config.rustPlugins
});
Expand Down
10 changes: 6 additions & 4 deletions packages/core/src/utils/trace-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { convertErrorMessage } from './error.js';

import * as fs from 'node:fs';
import { createInlineCompiler } from '../compiler/utils.js';
import type { Config } from '../types/binding.js';
import { ResolvedUserConfig } from '../config/types.js';

function createTraceDepCompiler(entry: string) {
const config = getDefaultTraceDepCompilerConfig(entry);
return createInlineCompiler(config, { progress: false });

return createInlineCompiler(config);
}

export async function traceDependencies(
Expand All @@ -29,9 +30,9 @@ export async function traceDependencies(
}
}

function getDefaultTraceDepCompilerConfig(entry: string): Config {
function getDefaultTraceDepCompilerConfig(entry: string): ResolvedUserConfig {
return {
config: {
compilation: {
input: {
index: entry
},
Expand All @@ -43,6 +44,7 @@ function getDefaultTraceDepCompilerConfig(entry: string): Config {
presetEnv: false,
persistentCache: false,
minify: false,
progress: false,
lazyCompilation: false
},
jsPlugins: [
Expand Down

0 comments on commit f510fbf

Please sign in to comment.