From 73ab65f617a93f6d5b9a5b336739272e25bcb77a Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Mon, 27 Mar 2017 21:16:29 +0200 Subject: [PATCH] fix: normalize umd bundle name after scope addition --- webpack.config.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 03d6060..b9f469c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,7 +1,8 @@ const { resolve } = require('path'); const webpack = require('webpack'); -const { name: packageName } = require('./package.json'); +const packageJSON = require('./package.json'); +const packageName = normalizePackageName(packageJSON.name); const PATHS = { entryPoint: resolve(__dirname, 'src/index.ts'), @@ -70,8 +71,9 @@ const config = (env) => { // we don't want any declaration file in the bundles // folder since it wouldn't be of any use ans the source // map already include everything for debugging + + // This cannot be set because -> Option 'declarationDir' cannot be specified without specifying option 'declaration'. // declaration: false, - configFileName: 'tsconfig.base.json', } }], }] @@ -99,3 +101,9 @@ function toUpperCase(myStr) { function pascalCase(myStr) { return toUpperCase(dashToCamelCase(myStr)); } + +function normalizePackageName(rawPackageName){ + const scopeEnd = rawPackageName.indexOf('/') + 1; + + return rawPackageName.substring(scopeEnd); +}