-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrollup.config.mjs
51 lines (49 loc) · 1.15 KB
/
rollup.config.mjs
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
51
/* eslint-disable jsdoc/valid-types */
import { defineConfig } from 'rollup';
import typescript from '@rollup/plugin-typescript';
import { babel } from '@rollup/plugin-babel';
import { terser } from '@wwa/rollup-plugin-terser';
/** @type {import('rollup').Plugin[]} */
const plugins = [
typescript(),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
extensions: ['.js', '.ts'],
presets: [['@babel/env', { loose: true, bugfixes: true, modules: false }]],
plugins: [['@wordpress/babel-plugin-makepot', { output: 'lang/two-factor-provider-webauthn-js.pot' }]],
babelrc: false,
}),
terser(),
];
export default defineConfig([
{
input: 'assets/profile.ts',
output: {
file: 'assets/profile.min.js',
sourcemap: 'hidden',
format: 'iife',
strict: false,
globals: {
jquery: 'jQuery',
'@wordpress/i18n': 'wp.i18n',
},
},
external: ['jquery', '@wordpress/i18n'],
plugins,
},
{
input: 'assets/login.ts',
output: {
file: 'assets/login.min.js',
sourcemap: 'hidden',
format: 'iife',
strict: false,
globals: {
'@wordpress/i18n': 'wp.i18n',
},
},
external: ['@wordpress/i18n'],
plugins,
},
]);