Skip to content

Commit

Permalink
fix: IE11 build
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisre committed Nov 30, 2020
1 parent 02814b0 commit d575ad6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions rollup/cjs.ie11.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import glob from 'matched';
import commonjs from '@rollup/plugin-commonjs';
import typescript from 'rollup-plugin-typescript2';
import resolve from '@rollup/plugin-node-resolve';
import mergeConfig from './merge-config';

const dir = './dist/ie11';

const config = {
input: glob.sync(['src/**/*.ts', '!src/index.ts', '!src/**/*.test.ts']),
preserveModules: true,
external: ['superstruct'],
output: {
dir,
format: 'cjs',
Expand All @@ -16,6 +18,11 @@ const config = {
},
},
plugins: [
resolve({
customResolveOptions: {
moduleDirectory: dir,
},
}),
commonjs(),
typescript({
clean: true,
Expand Down
4 changes: 1 addition & 3 deletions rollup/merge-config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { terser } from 'rollup-plugin-terser';
import resolve from '@rollup/plugin-node-resolve';

/**
* Merge rollup config with base config
Expand All @@ -8,14 +7,13 @@ import resolve from '@rollup/plugin-node-resolve';
export default function mergeRollupConfig(config) {
return {
...config,
external: ['react-hook-form'],
external: ['react-hook-form'].concat(config.external ?? []),
output: {
sourcemap: true,
exports: 'named',
...config.output,
},
plugins: [
resolve(),
terser({
output: { comments: false },
compress: {
Expand Down
2 changes: 2 additions & 0 deletions rollup/umd.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import typescript from 'rollup-plugin-typescript2';
import resolve from '@rollup/plugin-node-resolve';
import mergeConfig from './merge-config';

const dir = './dist/umd';
Expand All @@ -14,6 +15,7 @@ const config = {
},
},
plugins: [
resolve(),
typescript({
clean: true,
tsconfigOverride: {
Expand Down

0 comments on commit d575ad6

Please sign in to comment.