mirror of https://github.com/alibaba/ice.git
				
				
				
			fix: add transform include for non-js files (#599)
* fix: add transform include for non-js files * fix: optimize code
This commit is contained in:
		
							parent
							
								
									99c8a96f50
								
							
						
					
					
						commit
						ea2ebc29a0
					
				|  | @ -81,9 +81,12 @@ export default function importStylePlugin(options: TransformOptions) { | ||||||
|     name: 'transform-import-style', |     name: 'transform-import-style', | ||||||
|     // Add plugin as a post plugin, so we do not need to deal with ts language.
 |     // Add plugin as a post plugin, so we do not need to deal with ts language.
 | ||||||
|     enforce: 'post', |     enforce: 'post', | ||||||
|     async transform(code: string, id: string, transformOption: { isServer: Boolean }) { |     transformInclude(id: string) { | ||||||
|       // Only transform source code.
 |       // Only transform source code.
 | ||||||
|       if (transformOption.isServer || !code || !id.match(/\.(js|jsx|ts|tsx)$/) || id.match(/node_modules/)) { |       return id.match(/\.(js|jsx|ts|tsx)$/) && !id.match(/node_modules/); | ||||||
|  |     }, | ||||||
|  |     async transform(code: string, id: string, transformOption: { isServer: Boolean }) { | ||||||
|  |       if (transformOption.isServer || !code) { | ||||||
|         return null; |         return null; | ||||||
|       } |       } | ||||||
|       return await importStyle(code, options); |       return await importStyle(code, options); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue