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