Skip to content

Commit 88a1d3d

Browse files
committed
chore: bump version
1 parent db66919 commit 88a1d3d

4 files changed

Lines changed: 38 additions & 33 deletions

File tree

.changeset/swift-carrots-kick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"weapp-tailwindcss": patch
3+
---
4+
5+
fix: 跳过不正确的 `sourcemap` 处理覆盖

packages/weapp-tailwindcss/src/bundlers/vite/index.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,18 @@ export function UnifiedViteWeappTailwindcssPlugin(options: UserDefinedOptions =
134134
}
135135
},
136136
async () => {
137-
const mapFilename = `${file}.map`
138-
const hasSourceMap = Boolean(bundle[mapFilename])
139-
const { code, map } = await jsHandler(rawSource, runtimeSet, {
140-
generateMap: hasSourceMap,
137+
// const mapFilename = `${file}.map`
138+
// const hasSourceMap = Boolean(bundle[mapFilename])
139+
const { code } = await jsHandler(rawSource, runtimeSet, {
140+
// generateMap: hasSourceMap,
141141
})
142142
originalSource.code = code
143143
onUpdate(file, rawSource, code)
144144
debug('js handle: %s', file)
145145
// noCachedCount++
146-
if (hasSourceMap && map) {
147-
; (bundle[mapFilename] as OutputAsset).source = map.toString()
148-
}
146+
// if (hasSourceMap && map) {
147+
// ; (bundle[mapFilename] as OutputAsset).source = map.toString()
148+
// }
149149
return {
150150
key: file,
151151
source: code,
@@ -178,10 +178,10 @@ export function UnifiedViteWeappTailwindcssPlugin(options: UserDefinedOptions =
178178
}
179179
},
180180
async () => {
181-
const mapFilename = `${file}.map`
182-
const hasSourceMap = Boolean(bundle[mapFilename])
183-
const { code, map } = await jsHandler(rawSource, runtimeSet, {
184-
generateMap: hasSourceMap,
181+
// const mapFilename = `${file}.map`
182+
// const hasSourceMap = Boolean(bundle[mapFilename])
183+
const { code } = await jsHandler(rawSource, runtimeSet, {
184+
// generateMap: hasSourceMap,
185185
uniAppX,
186186
babelParserOptions: {
187187
plugins: [
@@ -194,9 +194,9 @@ export function UnifiedViteWeappTailwindcssPlugin(options: UserDefinedOptions =
194194
onUpdate(file, rawSource, code)
195195
debug('js handle: %s', file)
196196
// noCachedCount++
197-
if (hasSourceMap && map) {
198-
; (bundle[mapFilename] as OutputAsset).source = map.toString()
199-
}
197+
// if (hasSourceMap && map) {
198+
// ; (bundle[mapFilename] as OutputAsset).source = map.toString()
199+
// }
200200
return {
201201
key: file,
202202
source: code,

packages/weapp-tailwindcss/src/bundlers/webpack/BaseUnifiedPlugin/v4.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Compiler } from 'webpack4'
33
import type { AppType, IBaseWebpackPlugin, InternalUserDefinedOptions, UserDefinedOptions } from '@/types'
44
import fs from 'node:fs'
55
import path from 'node:path'
6-
import { ConcatSource, RawSource } from 'webpack-sources'
6+
import { ConcatSource } from 'webpack-sources'
77
import { pluginName } from '@/constants'
88
import { getCompilerContext } from '@/context'
99
import { createDebug } from '@/debug'
@@ -166,22 +166,22 @@ export class UnifiedWebpackPluginV4 implements IBaseWebpackPlugin {
166166
async () => {
167167
// @ts-ignore
168168
const rawSource = originalSource.source().toString()
169-
const mapFilename = `${file}.map`
170-
const hasMap = Boolean(assets[mapFilename])
171-
const { code, map } = await jsHandler(rawSource, runtimeSet, {
172-
generateMap: hasMap,
169+
// const mapFilename = `${file}.map`
170+
// const hasMap = Boolean(assets[mapFilename])
171+
const { code } = await jsHandler(rawSource, runtimeSet, {
172+
// generateMap: hasMap,
173173
})
174174
const source = new ConcatSource(code)
175175
// @ts-ignore
176176
compilation.updateAsset(file, source)
177177
onUpdate(file, rawSource, code)
178178
debug('js handle: %s', file)
179179

180-
if (hasMap && map) {
181-
const source = new RawSource(map.toString())
182-
// @ts-ignore
183-
compilation.updateAsset(mapFilename, source)
184-
}
180+
// if (hasMap && map) {
181+
// const source = new RawSource(map.toString())
182+
// // @ts-ignore
183+
// compilation.updateAsset(mapFilename, source)
184+
// }
185185
return {
186186
key: cacheKey,
187187
source,

packages/weapp-tailwindcss/src/bundlers/webpack/BaseUnifiedPlugin/v5.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class UnifiedWebpackPluginV5 implements IBaseWebpackPlugin {
4848
twPatcher.patch()
4949
// NormalModule,
5050
const { Compilation, sources, NormalModule } = compiler.webpack
51-
const { ConcatSource, RawSource } = sources
51+
const { ConcatSource } = sources
5252
// react
5353
function getClassSetInLoader() {
5454
if (twPatcher.majorVersion !== 4) {
@@ -167,20 +167,20 @@ export class UnifiedWebpackPluginV5 implements IBaseWebpackPlugin {
167167
},
168168
async () => {
169169
const rawSource = originalSource.source().toString()
170-
const mapFilename = `${file}.map`
171-
const hasMap = Boolean(assets[mapFilename])
172-
const { code, map } = await jsHandler(rawSource, runtimeSet, {
173-
generateMap: hasMap,
170+
// const mapFilename = `${file}.map`
171+
// const hasMap = Boolean(assets[mapFilename])
172+
const { code } = await jsHandler(rawSource, runtimeSet, {
173+
// generateMap: hasMap,
174174
})
175175
const source = new ConcatSource(code)
176176
compilation.updateAsset(file, source)
177177
onUpdate(file, rawSource, code)
178178
debug('js handle: %s', file)
179179

180-
if (hasMap && map) {
181-
const source = new RawSource(map.toString())
182-
compilation.updateAsset(mapFilename, source)
183-
}
180+
// if (hasMap && map) {
181+
// const source = new RawSource(map.toString())
182+
// compilation.updateAsset(mapFilename, source)
183+
// }
184184
return {
185185
key: cacheKey,
186186
source,

0 commit comments

Comments
 (0)