aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/rollup.config.js
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-06-17 12:40:42 -0300
committerSebastian <sebasjm@gmail.com>2021-06-17 12:49:47 -0300
commit1c7423dbad6c7a7d8efffadb3c854d961da17336 (patch)
tree8e98a834e092f2c72f0f8f10934f696e52800165 /packages/taler-wallet-core/rollup.config.js
parent46f3fcbbfbf6869128e1c596b620af63b770eb93 (diff)
downloadwallet-core-1c7423dbad6c7a7d8efffadb3c854d961da17336.tar.xz
fix support with webpack{4,5} in browser environment
added missing .js extension to the imports split index use browser field in package json
Diffstat (limited to 'packages/taler-wallet-core/rollup.config.js')
-rw-r--r--packages/taler-wallet-core/rollup.config.js35
1 files changed, 33 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/rollup.config.js b/packages/taler-wallet-core/rollup.config.js
index bcc8e5b26..fa5e1905c 100644
--- a/packages/taler-wallet-core/rollup.config.js
+++ b/packages/taler-wallet-core/rollup.config.js
@@ -6,8 +6,8 @@ import builtins from "builtin-modules";
import pkg from "./package.json";
import sourcemaps from 'rollup-plugin-sourcemaps';
-export default {
- input: "lib/index.js",
+const nodeEntryPoint = {
+ input: "lib/index.node.js",
output: {
file: pkg.main,
format: "cjs",
@@ -32,3 +32,34 @@ export default {
],
}
+const browserEntryPoint = {
+ input: "lib/index.browser.js",
+ output: {
+ file: pkg.browser[pkg.main],
+ format: "cjs",
+ sourcemap: true,
+ },
+ external: builtins,
+ plugins: [
+ nodeResolve({
+ preferBuiltins: true,
+ }),
+
+ sourcemaps(),
+
+ commonjs({
+ include: [/node_modules/, /dist/],
+ extensions: [".js"],
+ ignoreGlobal: false,
+ sourceMap: true,
+ }),
+
+ json(),
+ ],
+}
+
+export default [
+ nodeEntryPoint,
+ browserEntryPoint
+]
+