Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up package for module/nomodule distributions
We produce variants of the source code by rollup. Note using a "module" property is not (yet?) standard but the approach both webpack and rollup.js suggest going forward.
- Loading branch information
Showing
8 changed files
with
61 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
node_modules | ||
build | ||
dist | ||
.sizecache.json | ||
*.log* |
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,46 +1,53 @@ | ||
import { terser } from "rollup-plugin-terser"; | ||
import filesize from "rollup-plugin-filesize"; | ||
import license from "rollup-plugin-license"; | ||
import pkg from "./package.json"; | ||
|
||
export default { | ||
input: "src/js.cookie.mjs", | ||
output: [ | ||
// config for <script type="module"> | ||
{ | ||
dir: "build", | ||
entryFileNames: "[name].min.mjs", | ||
format: "esm" | ||
}, | ||
{ | ||
dir: "build", | ||
entryFileNames: `[name]-${pkg.version}.min.mjs`, | ||
format: "esm" | ||
}, | ||
// config for <script nomodule> | ||
{ | ||
dir: "build", | ||
name: "Cookies", | ||
entryFileNames: "[name].min.js", | ||
format: "umd" | ||
}, | ||
{ | ||
dir: "build", | ||
name: "Cookies", | ||
entryFileNames: `[name]-${pkg.version}.min.js`, | ||
format: "umd" | ||
} | ||
], | ||
// rollup-plugin-uglify only works with babel... | ||
plugins: [ | ||
terser(), | ||
license({ | ||
banner: { | ||
content: | ||
"/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */", | ||
commentStyle: "none" | ||
export default [ | ||
{ | ||
input: "src/js.cookie.mjs", | ||
output: [ | ||
// config for <script type="module"> | ||
{ | ||
dir: "dist", | ||
entryFileNames: "[name].mjs", | ||
format: "esm" | ||
}, | ||
// config for <script nomodule> | ||
{ | ||
dir: "dist", | ||
name: "Cookies", | ||
entryFileNames: "[name].js", | ||
format: "umd" | ||
} | ||
}), | ||
filesize() | ||
] | ||
}; | ||
] | ||
}, | ||
{ | ||
input: "src/js.cookie.mjs", | ||
output: [ | ||
// config for <script type="module"> | ||
{ | ||
dir: "dist", | ||
entryFileNames: "[name].min.mjs", | ||
format: "esm" | ||
}, | ||
// config for <script nomodule> | ||
{ | ||
dir: "dist", | ||
name: "Cookies", | ||
entryFileNames: "[name].min.js", | ||
format: "umd" | ||
} | ||
], | ||
plugins: [ | ||
terser(), | ||
license({ | ||
banner: { | ||
content: | ||
"/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */", | ||
commentStyle: "none" | ||
} | ||
}), | ||
filesize() | ||
] | ||
} | ||
]; |
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
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