Ajoute une version CDN de la lib (avec toutes les dépendances, pour utiliser directement dans le navigateur)

fix #1211
pull/1309/head
Johan Girod 2020-12-11 10:51:12 +01:00 committed by Johan Girod
parent 0d50e03777
commit 83b9e55d6e
3 changed files with 17 additions and 5 deletions

View File

@ -25,6 +25,7 @@
},
"scripts": {
"build": "node build.js",
"clean": "rimraf dist node_modules",
"prepare": "yarn run build",
"up": "yarn version --minor && echo \" N'oubliez pas de poussez le tag git\"",
"test": "echo 1"

View File

@ -20,6 +20,7 @@
"dist/index.js",
"dist/types",
"dist/images",
"dist/publicodes.min.js",
"esm"
],
"private": false,

View File

@ -7,17 +7,15 @@ const common = {
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
mode: 'development',
mode: process.env.NODE_ENV,
entry: path.resolve(__dirname, 'source', 'index.ts'),
module: {
rules: commonLoaders({ file: false }),
},
externals:
// Every non-relative module is external
/^[a-z\-0-9]+$/,
}
module.exports =
module.exports = [
// Config for UMD export (browser / node)
{
...common,
@ -27,4 +25,16 @@ module.exports =
libraryTarget: 'umd',
globalObject: 'this',
},
externals:
// Every non-relative module is external
/^[a-z\-0-9]+$/,
},
process.env.NODE_ENV === 'production' && {
...common,
output: {
filename: 'publicodes.min.js',
library: 'publicodes',
libraryTarget: 'global',
},
}
].filter(Boolean)