1
0
Fork 0
mirror of synced 2024-06-03 02:55:14 +12:00

Add commonJS fields to package.json for client and standard components so the server can require them

This commit is contained in:
Andrew Kingston 2021-04-07 11:31:19 +01:00
parent 6d8f27ba4e
commit 4cb085d80d
3 changed files with 12 additions and 2 deletions

View file

@ -3,11 +3,13 @@
"version": "0.8.9",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
"type": "module",
"svelte": "src/index.js",
"exports": {
".": {
"import": "./dist/budibase-client.js"
"import": "./dist/budibase-client.js",
"require": "./dist/budibase-client.js"
},
"./package.json": "./package.json"
},

View file

@ -165,7 +165,13 @@ exports.downloadTemplate = async (type, name) => {
exports.getComponentLibraryManifest = async (appId, library) => {
const filename = "manifest.json"
/* istanbul ignore next */
if (env.isTest() || env.isDev()) {
// when testing in cypress and so on we need to get the package
// as the environment may not be fully fleshed out for dev or prod
if (env.isTest()) {
const lib = library.split("/")[1]
const path = require.resolve(library).split(lib)[0]
return require(join(path, lib, filename))
} else if (env.isDev()) {
const path = join(
NODE_MODULES_PATH,
"@budibase",

View file

@ -1,10 +1,12 @@
{
"name": "@budibase/standard-components",
"module": "dist/standard-components.es.js",
"main": "dist/standard-components.es.js",
"svelte": "src/index.js",
"exports": {
".": {
"import": "./dist/standard-components.es.js"
"require": "./dist/standard-components.es.js"
},
"./package.json": "./package.json",
"./manifest.json": "./manifest.json"