@@ -20,7 +20,14 @@ import typescript from 'rollup-plugin-typescript2';
2020import json from '@rollup/plugin-json' ;
2121import OMT from '@surma/rollup-plugin-off-main-thread' ;
2222import logError from './log-error' ;
23- import { isDir , isFile , stdout , isTruthy , removeScope } from './utils' ;
23+ import {
24+ EXTENSION ,
25+ isDir ,
26+ isFile ,
27+ isTruthy ,
28+ stdout ,
29+ removeScope ,
30+ } from './utils' ;
2431import { getSizeInfo } from './lib/compressed-size' ;
2532import { normalizeMinifyOptions } from './lib/terser' ;
2633import {
@@ -279,17 +286,12 @@ function getMain({ options, entry, format }) {
279286
280287 let mainNoExtension = options . output ;
281288 if ( options . multipleEntries ) {
282- let name = entry . match (
283- / ( [ \\ / ] ) i n d e x ( \. ( u m d | c j s | e s | m ) ) ? \. ( m j s | c j s | [ t j ] s x ? ) $ / ,
284- )
289+ let name = entry . match ( new RegExp ( / ( [ \\ / ] ) i n d e x / . source + EXTENSION . source ) )
285290 ? mainNoExtension
286291 : entry ;
287292 mainNoExtension = resolve ( dirname ( mainNoExtension ) , basename ( name ) ) ;
288293 }
289- mainNoExtension = mainNoExtension . replace (
290- / ( \. ( u m d | c j s | e s | m ) ) ? \. ( m j s | c j s | [ t j ] s x ? ) $ / ,
291- '' ,
292- ) ;
294+ mainNoExtension = mainNoExtension . replace ( EXTENSION , '' ) ;
293295
294296 const mainsByFormat = { } ;
295297
@@ -482,10 +484,7 @@ function createConfig(options, entry, format, writeMeta) {
482484 extract :
483485 ! ! writeMeta &&
484486 options . css !== 'inline' &&
485- options . output . replace (
486- / ( \. ( u m d | c j s | e s | m ) ) ? \. ( m j s | [ t j ] s x ? ) $ / ,
487- '.css' ,
488- ) ,
487+ options . output . replace ( EXTENSION , '.css' ) ,
489488 minimize : options . compress ,
490489 sourceMap : options . sourcemap && options . css !== 'inline' ,
491490 } ) ,
0 commit comments