Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: option for disable esbuild #475

Merged
merged 1 commit into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/node/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export async function createBaseRollupPlugins(
rollupInputOptions = {},
transforms = [],
vueCustomBlockTransforms = {},
cssPreprocessOptions
cssPreprocessOptions,
enableEsbuild = true
} = options
const { nodeResolve } = require('@rollup/plugin-node-resolve')
const dynamicImport = require('rollup-plugin-dynamic-import-variables')
Expand All @@ -108,7 +109,9 @@ export async function createBaseRollupPlugins(
// vite:resolve
createBuildResolvePlugin(root, resolver),
// vite:esbuild
await createEsbuildPlugin(options.minify === 'esbuild', options.jsx),
enableEsbuild
? await createEsbuildPlugin(options.minify === 'esbuild', options.jsx)
: null,
// vue
require('rollup-plugin-vue')({
...options.rollupPluginVueOptions,
Expand Down
5 changes: 5 additions & 0 deletions src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export interface SharedConfig {
* CSS preprocess options
*/
cssPreprocessOptions?: SFCStyleCompileOptions['preprocessOptions']
/**
* Enable esbuild
* @default true
*/
enableEsbuild?: boolean
}

export interface ServerConfig extends SharedConfig {
Expand Down
7 changes: 4 additions & 3 deletions src/node/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export function createServer(config: ServerConfig): Server {
alias = {},
transforms = [],
vueCustomBlockTransforms = {},
optimizeDeps = {}
optimizeDeps = {},
enableEsbuild = true
} = config

const app = new Koa<State, Context>()
Expand Down Expand Up @@ -98,14 +99,14 @@ export function createServer(config: ServerConfig): Server {
: []),
vuePlugin,
cssPlugin,
esbuildPlugin,
enableEsbuild ? esbuildPlugin : null,
jsonPlugin,
assetPathPlugin,
webWorkerPlugin,
wasmPlugin,
serveStaticPlugin
]
resolvedPlugins.forEach((m) => m(context))
resolvedPlugins.forEach((m) => m && m(context))

const listen = server.listen.bind(server)
server.listen = (async (...args: any[]) => {
Expand Down