@@ -270,57 +270,3 @@ test('build as lib with --inline-vue', async () => {
270270 } )
271271 expect ( divText ) . toMatch ( 'Hello from Lib' )
272272} )
273-
274- test ( 'build as lib with contenthash in chunkFilename' , async ( ) => {
275- const project = await create ( 'build-lib-with-contenthash' , defaultPreset )
276-
277- // Create main entry with dynamic import to generate chunks
278- await project . write ( 'src/main.js' , `
279- export default { foo: 1 }
280- export const bar = 2
281-
282- // Dynamic import to create a chunk
283- export const loadAsync = () => import('./async-module.js')
284- ` )
285-
286- // Create async module
287- await project . write ( 'src/async-module.js' , `
288- export default { async: true, value: 'test' }
289- ` )
290-
291- // Configure contenthash in vue.config.js
292- await project . write ( 'vue.config.js' , `
293- module.exports = {
294- configureWebpack: {
295- output: {
296- chunkFilename: '[name].[contenthash:8].js'
297- }
298- }
299- }
300- ` )
301-
302- const { stdout } = await project . run ( 'vue-cli-service build --target lib --name testLib src/main.js' )
303- expect ( stdout ) . toMatch ( 'Build complete.' )
304-
305- // Check main files exist
306- expect ( project . has ( 'dist/testLib.common.js' ) ) . toBe ( true )
307- expect ( project . has ( 'dist/testLib.umd.js' ) ) . toBe ( true )
308- expect ( project . has ( 'dist/testLib.umd.min.js' ) ) . toBe ( true )
309-
310- // Check that chunk files have contenthash if any chunks are generated
311- const fs = require ( 'fs' )
312- const distPath = path . join ( project . dir , 'dist' )
313- const files = fs . readdirSync ( distPath )
314-
315- // Find chunk files (files with contenthash pattern)
316- const chunkFiles = files . filter ( f => / t e s t L i b \. u m d \. m i n \. [ ^ . ] + \. [ a - f 0 - 9 ] { 8 } \. j s $ / . test ( f ) )
317-
318- // If chunks are generated, they should have contenthash
319- if ( chunkFiles . length > 0 ) {
320- chunkFiles . forEach ( file => {
321- const hashMatch = file . match ( / \. ( [ a - f 0 - 9 ] { 8 } ) \. j s $ / )
322- expect ( hashMatch ) . toBeTruthy ( )
323- expect ( hashMatch [ 1 ] ) . toHaveLength ( 8 )
324- } )
325- }
326- } )
0 commit comments