-
Notifications
You must be signed in to change notification settings - Fork 186
/
Copy pathrollup.config.js
50 lines (49 loc) · 1.82 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import babel from '@rollup/plugin-babel';
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
export default [
{
input: './src/echo.ts',
output: [
{ file: './dist/echo.js', format: 'esm' },
{ file: './dist/echo.common.js', format: 'cjs' },
],
plugins: [
resolve(),
typescript({
tsconfig: './tsconfig.json', // Ensures Rollup aligns with your TS settings
}),
babel({
babelHelpers: 'bundled',
extensions: ['.ts'],
exclude: 'node_modules/**',
presets: ['@babel/preset-env'],
plugins: [
'@babel/plugin-transform-numeric-separator',
'@babel/plugin-transform-export-namespace-from',
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-proposal-function-sent',
'@babel/plugin-proposal-throw-expressions',
'@babel/plugin-transform-object-assign',
],
}),
],
external: ['jquery', 'axios', 'vue', '@hotwired/turbo', 'tslib'], // Compatible packages not included in the bundle
},
{
input: './src/index.iife.ts',
output: [{ file: './dist/echo.iife.js', format: 'iife', name: 'Echo' }],
plugins: [
resolve(),
typescript({
tsconfig: './tsconfig.json',
}),
babel({
babelHelpers: 'bundled',
extensions: ['.ts'],
exclude: 'node_modules/**',
}),
],
external: ['jquery', 'axios', 'vue', '@hotwired/turbo', 'tslib'], // Compatible packages not included in the bundle
},
];