1 const path = require('path')
2 const isProduction = process.env.NODE_ENV == 'production'
7 build.onResolve({filter: /^(index|server)\.ts$/}, args => {
13 build.onLoad({filter: /.*/, namespace: 'entry-ns'}, args => {
15 if (args.path == 'index.ts') {
17 import {activate, deactivate} from './src/index'
18 export {activate, deactivate}
20 } else if (args.path == 'server.ts') {
21 contents = `require('./server/eslintServer')`
23 throw new Error('Bad path')
33 async function start() {
34 await require('esbuild').build({
35 entryPoints: ['index.ts', 'server.ts'],
36 define: {'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')},
40 mainFields: ['module', 'main'],
42 sourcemap: !isProduction,
43 external: ['coc.nvim'],
44 outdir: path.resolve(__dirname, 'lib'),
45 plugins: [entryPlugin]