diff --git a/packages/taro-mini-runner/src/webpack/chain.ts b/packages/taro-mini-runner/src/webpack/chain.ts index 99802d4ea880..e276f58c8536 100644 --- a/packages/taro-mini-runner/src/webpack/chain.ts +++ b/packages/taro-mini-runner/src/webpack/chain.ts @@ -199,11 +199,15 @@ export const getModule = (appPath: string, { { importLoaders: 1, sourceMap: enableSourceMap, - modules: namingPattern === 'module' ? true : 'global' + modules: { + mode: namingPattern === 'module' ? 'local' : 'global' + } }, - typeof generateScopedName === 'function' + { + modules: typeof generateScopedName === 'function' ? { getLocalIdent: (context, _, localName) => generateScopedName(localName, context.resourcePath) } : { localIdentName: generateScopedName } + } ), cssLoaderOption ]