esbuild-node-tsc icon indicating copy to clipboard operation
esbuild-node-tsc copied to clipboard

How transform to esm?

Open seho-dev opened this issue 4 years ago • 7 comments

const esbuildPluginTsc = require('esbuild-plugin-tsc');

module.exports = {
  outDir: './dist',
  esbuild: {
    minify: false,
    format: "esm",
    target: 'es2015',
    plugins: [esbuildPluginTsc()]
  },
  assets: {
    baseDir: 'src',
    outDir: './dist',
    filePatterns: ['**/*.json']
  }
};

seho-dev avatar Sep 03 '21 02:09 seho-dev

Seems like format is hardcoded to cjs and, since the spread operator comes first, format value cannot be overridden by an option:

https://github.com/a7ul/esbuild-node-tsc/blob/81f32d98b332d3d4b0e93516c3e200d650e17944/src/index.ts#L87-L94

desko27 avatar Nov 22 '21 21:11 desko27

ohhhh all right

seho-dev avatar Nov 23 '21 01:11 seho-dev

could you raise a pr for this ?

a7ul avatar Nov 23 '21 08:11 a7ul

ok, look like so easy

seho-dev avatar Nov 23 '21 08:11 seho-dev

this is pr: https://github.com/a7ul/esbuild-node-tsc/pull/36

seho-dev avatar Nov 23 '21 08:11 seho-dev

Not sure #36 alone solves the issue, please @1018715564 let us know

desko27 avatar Nov 23 '21 09:11 desko27

sorry, Due to my negligence, I forgot to add the format option to config this is pr: https://github.com/a7ul/esbuild-node-tsc/pull/38

I have tested it and can package the code in esm format normally

image

seho-dev avatar Nov 24 '21 02:11 seho-dev