File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ const readFile = promisify(fs.readFile);
2424const stat = promisify ( fs . stat ) ;
2525const isDir = name => stat ( name ) . then ( stats => stats . isDirectory ( ) ) . catch ( ( ) => false ) ;
2626const isFile = name => stat ( name ) . then ( stats => stats . isFile ( ) ) . catch ( ( ) => false ) ;
27- const safeVariableName = name => camelCase ( name . toLowerCase ( ) . replace ( / ( ( ^ [ ^ a - z A - Z ] + ) | [ ^ \w . - ] ) | ( [ ^ a - z A - Z 0 - 9 ] + $ ) / g, '' ) ) ;
27+ const removeScope = name => name . replace ( / ^ @ .* \/ / , '' ) ;
28+ const safeVariableName = name => camelCase ( removeScope ( name ) . toLowerCase ( ) . replace ( / ( ( ^ [ ^ a - z A - Z ] + ) | [ ^ \w . - ] ) | ( [ ^ a - z A - Z 0 - 9 ] + $ ) / g, '' ) ) ;
2829
2930const WATCH_OPTS = {
3031 exclude : 'node_modules/**'
@@ -55,7 +56,7 @@ export default async function microbundle(options) {
5556
5657 let main = resolve ( cwd , options . output || options . pkg . main || 'dist' ) ;
5758 if ( ! main . match ( / \. [ a - z ] + $ / ) || await isDir ( main ) ) {
58- main = resolve ( main , `${ options . pkg . name } .js` ) ;
59+ main = resolve ( main , `${ removeScope ( options . pkg . name ) } .js` ) ;
5960 }
6061 options . output = main ;
6162
You can’t perform that action at this time.
0 commit comments