local build
[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
repls build
https://repl.it/repls/TrimScornfulApplicationframework
The "buildStart" hook used by the output plugin typescript is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.
Build multiple versions
Build fail
error: [!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
As the warning states, yes, this plugin cannot be used as an output plugin. You need to specify the plugins option at the top level.
@lukastaegert
I want to compile multiple plug-ins at one time. What should I do with different plugins?
_Currently, rollup or @rollup/plugin-typescript does not support this syntax_
export default {
input: "src/index.ts",
output: [
{
file: `dist/${name}.esm.js`,
format: "es",
plugins: [typescript()],
},
{
file: `dist/${name}.min.js`,
format: "es",
plugins: [babel(), typescript()],
},
],
};
export default {
input: "src/index.ts",
plugins: [typescript()],
output: [
{
file: `dist/${name}.esm.js`,
format: "es"
},
{
file: `dist/${name}.min.js`,
format: "es",
plugins: [babel()],
},
],
};
The TypeScript plugin MUST run before Rollup processes files so it MUST be an input plugin. Per-output plugins can only run AFTER Rollup has processed files, and Rollup does not understand TypeScript.
But note that you also need the @rollup/plugin-babel@next to run this one per output, and you need to configure it in a special way.