Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IE11 bundle #85

Merged
merged 1 commit into from
Nov 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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