refactor(builds): drop cjs bundle, add type=module
This commit is contained in:
7
.postcssrc.json
Normal file
7
.postcssrc.json
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
{
|
||||
"plugins": {
|
||||
"autoprefixer" : {},
|
||||
"postcss-nested": {}
|
||||
}
|
||||
}
|
||||
5
.prettierrc.json
Normal file
5
.prettierrc.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"trailingComma": "es5",
|
||||
"singleQuote": true,
|
||||
"printWidth": 120
|
||||
}
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "react-flow-renderer",
|
||||
"version": "10.0.0-next.45",
|
||||
"version": "10.0.0-next.46",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "react-flow-renderer",
|
||||
"version": "10.0.0-next.45",
|
||||
"version": "10.0.0-next.46",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{
|
||||
"name": "react-flow-renderer",
|
||||
"version": "10.0.0-next.45",
|
||||
"version": "10.0.0-next.46",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"type": "module",
|
||||
"main": "dist/ReactFlow.js",
|
||||
"module": "dist/ReactFlow.esm.js",
|
||||
"module": "dist/ReactFlow.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: [require('autoprefixer'), require('postcss-nested')],
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
trailingComma: 'es5',
|
||||
singleQuote: true,
|
||||
printWidth: 120
|
||||
};
|
||||
@@ -16,7 +16,7 @@ const isProd = process.env.NODE_ENV === 'production';
|
||||
const isTesting = process.env.NODE_ENV === 'testing';
|
||||
const processEnv = isProd || isTesting ? 'production' : 'development';
|
||||
|
||||
export const baseConfig = ({ mainFile = pkg.main, moduleFile = pkg.module, injectCSS = true } = {}) => ({
|
||||
export const baseConfig = ({ outputFile = pkg.module, injectCSS = true } = {}) => ({
|
||||
input: 'src/index.ts',
|
||||
external: [
|
||||
'react',
|
||||
@@ -35,20 +35,13 @@ export const baseConfig = ({ mainFile = pkg.main, moduleFile = pkg.module, injec
|
||||
rollupWarn(warning);
|
||||
}
|
||||
},
|
||||
output: [
|
||||
{
|
||||
file: mainFile,
|
||||
format: 'cjs',
|
||||
sourcemap: true,
|
||||
exports: 'named',
|
||||
},
|
||||
{
|
||||
file: moduleFile,
|
||||
format: 'esm',
|
||||
sourcemap: true,
|
||||
exports: 'named',
|
||||
},
|
||||
],
|
||||
output: {
|
||||
file: outputFile,
|
||||
format: 'esm',
|
||||
sourcemap: true,
|
||||
exports: 'named',
|
||||
},
|
||||
|
||||
plugins: [
|
||||
alias({
|
||||
entries: [{ find: 'd3-color', replacement: __dirname + '/src/d3-color-alias' }],
|
||||
@@ -84,8 +77,7 @@ export default isProd && !isTesting
|
||||
? [
|
||||
baseConfig(),
|
||||
baseConfig({
|
||||
mainFile: 'dist/nocss/ReactFlow-nocss.js',
|
||||
moduleFile: 'dist/nocss/ReactFlow-nocss.esm.js',
|
||||
outputFile: 'dist/nocss/ReactFlow-nocss.esm.js',
|
||||
injectCSS: false,
|
||||
}),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user