From d4f85125dfe7f2dd193aa571cd0aeaf7cd6b805a Mon Sep 17 00:00:00 2001 From: adueck Date: Thu, 6 Oct 2022 20:38:00 +0500 Subject: [PATCH] try again --- package.json | 12 ++++++++---- src/rollup.config.js | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 src/rollup.config.js diff --git a/package.json b/package.json index 8045e5d..3c33691 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,14 @@ { "name": "@lingdocs/pashto-inflector", - "version": "4.9.15", + "version": "4.9.14", "author": "lingdocs.com", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "homepage": "https://verbs.lingdocs.com", "license": "MIT", - "main": "dist/library.js", + "exports": { + "./functions": "./dist-cjs/dist/functions.js", + "./components": "./dist-cjs/dist/components.js" + }, "module": "dist/library.js", "types": "dist/library.d.ts", "private": false, @@ -27,7 +30,8 @@ "jsurl2": "^2.1.0", "lz-string": "^1.4.4", "pbf": "^3.2.1", - "rambda": "^6.7.0" + "rambda": "^6.7.0", + "react-select": "^4.3.1" }, "devDependencies": { "@fortawesome/fontawesome-free": "^5.15.2", @@ -69,7 +73,7 @@ "test": "react-scripts test", "eject": "react-scripts eject", "build-website": "node get-words.js && npm run build", - "build-library": "node get-words.js && rimraf dist && tsc --project library-tsconfig.json && node library-post-build.js", + "build-library": "node get-words.js && rimraf dist && rimraf dist-cjs && tsc --project library-tsconfig.json && node library-post-build.js && rollup -c", "test-ci": "npm run test -- --watchAll=false", "get-words": "node get-words.js" }, diff --git a/src/rollup.config.js b/src/rollup.config.js new file mode 100644 index 0000000..1b13ec1 --- /dev/null +++ b/src/rollup.config.js @@ -0,0 +1,36 @@ +import image from '@rollup/plugin-image'; +import { nodeResolve } from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import pkg from './package.json'; +import multiInput from 'rollup-plugin-multi-input'; + +const banner = ` +/** + * Copyright (c) 2021 lingdocs.com + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +`; + +export default { + input: ['dist/functions.js', 'dist/components.js'], + external: ["react", "react-dom", "react-bootstrap"], + output: [{ + dir: "dist-cjs", + format: 'cjs', + sourcemap: true, + banner, + }], + plugins: [ + // peerDepsExternal(), + multiInput(), + commonjs(), + nodeResolve({ + resolveOnly: Object.keys(pkg.dependencies), + }), + // use base64 image inlining for the cjs version so that the .svg s can get cosumed by node 12 etc. + image(), + ] +} \ No newline at end of file