-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
181 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,87 @@ | ||
import {babel} from '@rollup/plugin-babel'; | ||
import peerDepsExternal from 'rollup-plugin-peer-deps-external'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import filesize from 'rollup-plugin-filesize'; | ||
import localResolve from '@haensl/rollup-plugin-local-resolve'; | ||
import { babel } from "@rollup/plugin-babel"; | ||
import peerDepsExternal from "rollup-plugin-peer-deps-external"; | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import filesize from "rollup-plugin-filesize"; | ||
import localResolve from "@haensl/rollup-plugin-local-resolve"; | ||
import replace from "@rollup/plugin-replace"; | ||
|
||
import typescript from "rollup-plugin-typescript2"; | ||
|
||
import terser from "@rollup/plugin-terser"; | ||
import{ dts} from "rollup-plugin-dts"; | ||
|
||
import packageJson from './package.json'; | ||
|
||
import { dts } from "rollup-plugin-dts"; | ||
import packageJson from "./package.json"; | ||
const outputCommonConf = { | ||
sourcemap: 'inline', | ||
exports: 'named', | ||
sourcemap: "inline", | ||
exports: "named", | ||
globals: { | ||
react: 'React', | ||
'react-dom/client': 'ReactDOM' | ||
} | ||
react: "React", | ||
"react-dom/client": "ReactDOM", | ||
}, | ||
}; | ||
|
||
|
||
|
||
export default [ | ||
{ | ||
input: "./src/index.tsx", | ||
output: [ | ||
{ | ||
file: packageJson['umd:main'], | ||
format: 'umd', | ||
name: 'ReactScriptTag', | ||
...outputCommonConf | ||
}, | ||
{ | ||
file: packageJson.main, | ||
format: 'cjs', | ||
...outputCommonConf | ||
}, | ||
{ | ||
file: packageJson.module, | ||
format: 'es', | ||
...outputCommonConf | ||
}, | ||
{ | ||
input: "./src/index.tsx", | ||
output: [ | ||
{ | ||
file: packageJson["umd:main"], | ||
format: "umd", | ||
name: "ReactScriptTag", | ||
...outputCommonConf, | ||
}, | ||
{ | ||
file: packageJson.main, | ||
format: "cjs", | ||
...outputCommonConf, | ||
}, | ||
{ | ||
file: packageJson.module, | ||
format: "es", | ||
...outputCommonConf, | ||
}, | ||
], | ||
plugins: [ | ||
peerDepsExternal(), | ||
localResolve(), | ||
babel({ | ||
exclude: "node_modules/**, src/tests/**", | ||
|
||
babelHelpers: "external", | ||
presets: [ | ||
"@babel/preset-env", | ||
"@babel/preset-react", | ||
"@babel/preset-typescript", | ||
], | ||
plugins: [ | ||
peerDepsExternal(), | ||
localResolve(), | ||
babel({ exclude: 'node_modules/**, src/tests/**' , | ||
|
||
babelHelpers: 'external', | ||
presets: [ | ||
"@babel/preset-env", | ||
"@babel/preset-react", | ||
"@babel/preset-typescript" | ||
], | ||
}), | ||
|
||
}), | ||
replace({ | ||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV), | ||
preventAssignment: true, | ||
}), | ||
|
||
|
||
|
||
replace({ | ||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV) | ||
}), | ||
resolve(), | ||
commonjs(), | ||
typescript({ | ||
tsconfig: "./tsconfig.json", | ||
sourceMap: true, | ||
tsconfigOverride: { | ||
include: ["src/index.tsx"], | ||
outDir: "lib", | ||
}, | ||
}), | ||
|
||
|
||
resolve(), | ||
commonjs(), | ||
typescript({ tsconfig: "./tsconfig.json", | ||
"sourceMap": true, | ||
|
||
"tsconfigOverride": { | ||
"include": [ | ||
"src/index.tsx", | ||
], | ||
"outDir": "lib", | ||
|
||
}, | ||
|
||
}), | ||
|
||
terser( { | ||
format:{ | ||
comments: "some", | ||
preamble: "/* react-linkedinbadge */" | ||
} | ||
}), | ||
terser({ | ||
format: { | ||
comments: "some", | ||
preamble: "/* react-linkedinbadge */", | ||
}, | ||
}), | ||
|
||
filesize(), | ||
], | ||
external: ["react", "react-dom", "styled-components"] | ||
}, | ||
{ | ||
input: "types/index.d.ts", | ||
output: [{ file: "lib/bundle.esm.d.ts", format: "esm" }], | ||
plugins: [dts()], | ||
}, | ||
]; | ||
filesize(), | ||
], | ||
external: ["react", "react-dom", "styled-components"], | ||
}, | ||
{ | ||
input: "types/index.d.ts", | ||
output: [{ file: "lib/bundle.esm.d.ts", format: "esm" }], | ||
plugins: [dts()], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,52 @@ | ||
import babel from "@rollup/plugin-babel"; | ||
import peerDepsExternal from 'rollup-plugin-peer-deps-external'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
|
||
|
||
import babel from "@rollup/plugin-babel"; | ||
import peerDepsExternal from "rollup-plugin-peer-deps-external"; | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
import replace from "@rollup/plugin-replace"; | ||
import typescript from 'rollup-plugin-typescript2'; | ||
|
||
import typescript from "rollup-plugin-typescript2"; | ||
import terser from "@rollup/plugin-terser"; | ||
|
||
const config = { | ||
input: 'src/main/index.tsx', | ||
|
||
output: [ | ||
{ | ||
|
||
file: 'lib/linkedinbadge.js', | ||
// cdn format | ||
format: 'umd', | ||
name: 'LinkedInBadge', | ||
|
||
globals: { | ||
react: 'React', | ||
'react-dom/client': 'ReactDOM' | ||
|
||
}, | ||
sourcemap:'inline' | ||
|
||
} | ||
], | ||
plugins: [ | ||
|
||
|
||
typescript({ useTsconfigDeclarationDir: true , | ||
sourceMap: true, | ||
}), | ||
peerDepsExternal(), | ||
babel({ | ||
exclude: 'node_modules/**', | ||
babelHelpers: 'external', | ||
presets: [ | ||
"@babel/preset-env", | ||
"@babel/preset-react", | ||
"@babel/preset-typescript" | ||
], | ||
}), | ||
resolve(), | ||
|
||
replace({ | ||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV) | ||
}), | ||
|
||
|
||
terser( { | ||
format:{ | ||
comments: "all", | ||
preamble: `${process.env.CDN_PREAMBLE_COMMENTARY_NOTICE || "/* LinkedInBadge */"}` | ||
} | ||
}), | ||
|
||
], | ||
|
||
|
||
external: ['react', 'react-dom/client', 'react-dom'], | ||
input: "src/main/index.tsx", | ||
output: [ | ||
{ | ||
file: "lib/linkedinbadge.js", | ||
format: "umd", | ||
name: "LinkedInBadge", | ||
globals: { | ||
react: "React", | ||
"react-dom/client": "ReactDOM", | ||
}, | ||
sourcemap: "inline", | ||
}, | ||
], | ||
plugins: [ | ||
typescript({ | ||
useTsconfigDeclarationDir: true, | ||
sourceMap: true, | ||
}), | ||
peerDepsExternal(), | ||
babel({ | ||
exclude: "node_modules/**", | ||
babelHelpers: "external", | ||
presets: [ | ||
"@babel/preset-env", | ||
"@babel/preset-react", | ||
"@babel/preset-typescript", | ||
], | ||
}), | ||
resolve(), | ||
replace({ | ||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV), | ||
preventAssignment: true, | ||
}), | ||
terser({ | ||
format: { | ||
comments: "all", | ||
preamble: `${process.env.CDN_PREAMBLE_COMMENTARY_NOTICE || "/* LinkedInBadge */"}`, | ||
}, | ||
}), | ||
], | ||
external: ["react", "react-dom/client", "react-dom"], | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.