Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
fix(build): remove module/es6
Browse files Browse the repository at this point in the history
  • Loading branch information
mderrier committed Nov 23, 2020
1 parent cebb12a commit b890bfd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 50 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"postversion": "bash ./scripts/github-release.sh"
},
"main": "./dist/mathlive.js",
"module": "./dist/mathlive.mjs",
"types": "./dist/public/mathlive.d.ts",
"files": [
"/dist",
Expand Down
57 changes: 10 additions & 47 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,52 +174,23 @@ const ROLLUP = [
}),
typescript(TYPESCRIPT_OPTIONS),
],
output: true
? [
// JavaScript native module
// (stricly speaking not necessary, since the UMD output is module
// compatible, but this gives us a "clean" module)
{
format: 'es',
file: `${BUILD_DIRECTORY}/mathlive.mjs`,
sourcemap: !PRODUCTION,
exports: 'named',
},
// UMD file, suitable for import, <script> and require()
{
format: 'umd',
name: 'MathLive',
file: `${BUILD_DIRECTORY}/mathlive.es6.js`,
sourcemap: !PRODUCTION,
exports: 'named',
},
]
: [
{
format: 'es',
file: `${BUILD_DIRECTORY}/mathlive.mjs`,
sourcemap: !PRODUCTION,
},
],
output: [
// UMD file, suitable for import, <script> and require()
{
format: 'umd',
name: 'MathLive',
file: `${BUILD_DIRECTORY}/mathlive.es6.js`,
sourcemap: !PRODUCTION,
exports: 'named',
},
],
watch: {
clearScreen: true,
exclude: ['node_modules/**'],
},
},
];

// MathLive Vue-js adapter
ROLLUP.push({
input: 'src/vue-mathlive.js',
plugins: [terser(TERSER_OPTIONS)],
output: {
// JavaScript native module
sourcemap: false,
file: 'dist/vue-mathlive.mjs',
format: 'es',
},
});

if (PRODUCTION) {
// Minified versions
ROLLUP.push({
Expand All @@ -244,14 +215,6 @@ if (PRODUCTION) {
terser(TERSER_OPTIONS),
],
output: [
// JavaScript native module
// (stricly speaking not necessary, since the UMD output is module
// compatible, but this gives us a "clean" module)
{
format: 'es',
file: `${BUILD_DIRECTORY}/mathlive.min.mjs`,
sourcemap: false,
},
// UMD file, suitable for import, <script> and require()
{
format: 'umd',
Expand Down
4 changes: 2 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ else
printf "\033[32m ● \033[0m Making a \033[33m%s\033[0m build es5 " "$BUILD"
npx babel -o dist/mathlive.js dist/mathlive.es6.js
echo -e "\033[2K\033[80D\033[32m ✔ \033[33m" $BUILD "\033[0m build es5 done"

rm -f dist/mathlive.es6.js
if [ "$BUILD" = "production" ]; then
# Optimize CSS
printf "\033[32m ● \033[0m Optimizing CSS"
Expand All @@ -106,7 +106,7 @@ else
# Stamp the SDK version number
printf "\033[32m ● \033[0m Stamping output files"
find ./dist -type f -name '*.css' -exec bash -c 'sedi "1s/^/\/\* $SDK_VERSION \*\//" {}' \;
find ./dist -type f \( -name '*.mjs' -o -name '*.js' \) -exec bash -c 'sedi s/{{SDK_VERSION}}/$SDK_VERSION/g {}' \;
#find ./dist -type f \( -name '*.mjs' -o -name '*.js' \) -exec bash -c 'sedi s/{{SDK_VERSION}}/$SDK_VERSION/g {}' \;
find ./dist -type f -name '*.d.ts' -exec bash -c 'sedi "1s/^/\/\* $SDK_VERSION \*\/$(printf '"'"'\r'"'"')/" {}' \;
find ./dist -type f -name '*.d.ts' -exec bash -c 'sedi "s/{{SDK_VERSION}}/$SDK_VERSION/" {}' \;
echo -e "\033[2K\033[80D\033[32m ✔ \033[0m Output files stamped"
Expand Down

0 comments on commit b890bfd

Please sign in to comment.