mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
chore: tidy up deps and export cjs & esm modules
This commit is contained in:
parent
bec0be562b
commit
80c0ec95d5
@ -20,7 +20,8 @@
|
||||
"url": "https://strapi.io"
|
||||
}
|
||||
],
|
||||
"main": "build/index.js",
|
||||
"main": "build/helper-plugin.cjs.js",
|
||||
"module": "build/helper-plugin.esm.js",
|
||||
"files": [
|
||||
"build"
|
||||
],
|
||||
@ -39,13 +40,13 @@
|
||||
"watch": "yarn create:index && cross-env NODE_ENV=development webpack-cli -w"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/design-system": "1.4.1",
|
||||
"@strapi/icons": "1.4.1",
|
||||
"axios": "1.2.1",
|
||||
"date-fns": "2.29.3",
|
||||
"formik": "^2.2.6",
|
||||
"immer": "9.0.6",
|
||||
"invariant": "^2.2.1",
|
||||
"lodash": "4.17.21",
|
||||
"match-sorter": "^4.0.2",
|
||||
"qs": "6.11.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
@ -64,16 +65,33 @@
|
||||
"@storybook/builder-webpack5": "6.5.15",
|
||||
"@storybook/manager-webpack5": "6.5.15",
|
||||
"@storybook/react": "^6.5.10",
|
||||
"@strapi/design-system": "1.4.1",
|
||||
"@strapi/icons": "1.4.1",
|
||||
"@testing-library/react": "12.1.4",
|
||||
"@testing-library/react-hooks": "8.0.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-loader": "^2.20.0",
|
||||
"react-test-renderer": "^17.0.2",
|
||||
"require-from-string": "2.0.2",
|
||||
"match-sorter": "^4.0.2",
|
||||
"rimraf": "3.0.2",
|
||||
"typescript": "4.6.2"
|
||||
"typescript": "4.6.2",
|
||||
"webpack": "^5.74.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@strapi/design-system": "1.4.1",
|
||||
"@strapi/icons": "1.4.1",
|
||||
"axios": "1.2.1",
|
||||
"date-fns": "2.29.3",
|
||||
"formik": "^2.2.6",
|
||||
"immer": "9.0.6",
|
||||
"lodash": "4.17.21",
|
||||
"qs": "6.11.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-helmet": "^6.1.0",
|
||||
"react-intl": "5.25.1",
|
||||
"react-router": "^5.2.0",
|
||||
"react-router-dom": "5.3.4",
|
||||
"react-select": "5.6.0",
|
||||
"styled-components": "5.3.3",
|
||||
"whatwg-fetch": "^3.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.19.1 <=18.x.x",
|
||||
@ -87,8 +105,5 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"peerDependencies": {
|
||||
"webpack": "^5.74.0"
|
||||
}
|
||||
}
|
||||
|
@ -4,15 +4,12 @@ const { ESBuildMinifyPlugin } = require('esbuild-loader');
|
||||
const packageJson = require('./package.json');
|
||||
|
||||
const nodeModules = [];
|
||||
[
|
||||
...Object.keys(packageJson.dependencies || {}),
|
||||
...Object.keys(packageJson.peerDependencies || {}),
|
||||
...Object.keys(packageJson.devDependencies || {}),
|
||||
].forEach((module) => {
|
||||
Object.keys(packageJson.peerDependencies).forEach((module) => {
|
||||
nodeModules.push(new RegExp(`^${module}(/.+)?$`));
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
/** @type {Omit<import('webpack').Configuration, 'output'>} */
|
||||
const baseConfig = {
|
||||
entry: `${__dirname}/lib/src/index.js`,
|
||||
externals: nodeModules,
|
||||
mode: process.env.NODE_ENV,
|
||||
@ -25,15 +22,6 @@ module.exports = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
output: {
|
||||
path: `${__dirname}/build`,
|
||||
filename: `helper-plugin.${process.env.NODE_ENV}.js`,
|
||||
library: {
|
||||
name: 'helperPlugin',
|
||||
type: 'umd',
|
||||
},
|
||||
umdNamedDefine: true,
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
@ -67,3 +55,32 @@ module.exports = {
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
/** @type {import('webpack').Configuration[]} */
|
||||
const config = [
|
||||
{
|
||||
...baseConfig,
|
||||
output: {
|
||||
path: `${__dirname}/build`,
|
||||
filename: `helper-plugin.esm.js`,
|
||||
library: {
|
||||
type: 'module',
|
||||
},
|
||||
},
|
||||
experiments: {
|
||||
outputModule: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
...baseConfig,
|
||||
output: {
|
||||
path: `${__dirname}/build`,
|
||||
filename: `helper-plugin.cjs.js`,
|
||||
library: {
|
||||
type: 'commonjs',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = config;
|
||||
|
@ -13086,7 +13086,7 @@ into-stream@^5.1.0:
|
||||
from2 "^2.3.0"
|
||||
p-is-promise "^3.0.0"
|
||||
|
||||
invariant@^2.2.1, invariant@^2.2.4:
|
||||
invariant@^2.2.4:
|
||||
version "2.2.4"
|
||||
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
|
||||
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
|
||||
@ -19145,7 +19145,7 @@ require-directory@^2.1.1:
|
||||
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
||||
integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==
|
||||
|
||||
require-from-string@2.0.2, require-from-string@^2.0.2:
|
||||
require-from-string@^2.0.2:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"
|
||||
integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==
|
||||
|
Loading…
x
Reference in New Issue
Block a user