2022-04-22 23:42:11 +01:00
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
2022-05-13 22:18:19 +01:00
|
|
|
import json from '@rollup/plugin-json';
|
2022-04-22 23:42:11 +01:00
|
|
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
|
|
import replace from '@rollup/plugin-replace';
|
|
|
|
import typescript from '@rollup/plugin-typescript';
|
|
|
|
import { defineConfig } from 'rollup';
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
input: './src/index.tsx',
|
|
|
|
plugins: [
|
|
|
|
commonjs(),
|
|
|
|
nodeResolve(),
|
|
|
|
typescript(),
|
2022-05-13 22:18:19 +01:00
|
|
|
json(),
|
2022-04-22 23:42:11 +01:00
|
|
|
replace({
|
|
|
|
preventAssignment: false,
|
|
|
|
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
context: 'window',
|
|
|
|
external: ['react', 'react-dom'],
|
|
|
|
output: {
|
2022-05-20 23:13:31 +01:00
|
|
|
file: 'dist/index.js',
|
2022-04-22 23:42:11 +01:00
|
|
|
globals: {
|
|
|
|
react: 'SP_REACT',
|
2022-05-20 23:13:31 +01:00
|
|
|
'react-dom': 'SP_REACTDOM',
|
2022-04-22 23:42:11 +01:00
|
|
|
},
|
|
|
|
format: 'iife',
|
|
|
|
exports: 'default',
|
|
|
|
},
|
|
|
|
});
|