Skip to content

Commit

Permalink
[1.x] Fix IIFE build (#344)
Browse files Browse the repository at this point in the history
* fix iife build

* code style
  • Loading branch information
timacdonald committed Jun 29, 2022
1 parent cd608aa commit 358a340
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 25 deletions.
58 changes: 33 additions & 25 deletions rollup.config.js
@@ -1,28 +1,36 @@
import babel from '@rollup/plugin-babel';
import typescript from 'rollup-plugin-typescript2';

export default {
input: './src/echo.ts',
output: [
{ file: './dist/echo.js', format: 'esm' },
{ file: './dist/echo.common.js', format: 'cjs' },
{ file: './dist/echo.iife.js', format: 'iife', name: 'Echo' },
],
plugins: [
typescript(),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
extensions: ['.ts'],
presets: ['@babel/preset-env'],
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-proposal-function-sent',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-throw-expressions',
'@babel/plugin-transform-object-assign',
],
}),
],
};
const plugins = [
typescript(),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
extensions: ['.ts'],
presets: ['@babel/preset-env'],
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-proposal-function-sent',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-throw-expressions',
'@babel/plugin-transform-object-assign',
],
}),
];

export default [
{
input: './src/echo.ts',
output: [
{ file: './dist/echo.js', format: 'esm' },
{ file: './dist/echo.common.js', format: 'cjs' },
],
plugins,
},
{
input: './src/index.iife.ts',
output: [{ file: './dist/echo.iife.js', format: 'iife', name: 'Echo' }],
plugins,
},
];
1 change: 1 addition & 0 deletions src/index.iife.ts
@@ -0,0 +1 @@
export { default } from './echo';

0 comments on commit 358a340

Please sign in to comment.