File tree Expand file tree Collapse file tree 1 file changed +21
-14
lines changed
packages/@vue/cli-service/lib/config Expand file tree Collapse file tree 1 file changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -240,20 +240,27 @@ module.exports = (api, options) => {
240240
241241 // copy static assets in public/
242242 const publicDir = api . resolve ( 'public' )
243- if ( ! isLegacyBundle && fs . existsSync ( publicDir ) ) {
244- webpackConfig
245- . plugin ( 'copy' )
246- . use ( require ( 'copy-webpack-plugin' ) , [ {
247- patterns : [ {
248- from : publicDir ,
249- to : outputDir ,
250- toType : 'dir' ,
251- noErrorOnMissing : true ,
252- globOptions : {
253- ignore : publicCopyIgnore
254- }
255- } ]
256- } ] )
243+ const CopyWebpackPlugin = require ( 'copy-webpack-plugin' )
244+ const PlaceholderPlugin = class PlaceholderPlugin { apply ( ) { } }
245+
246+ const copyOptions = {
247+ patterns : [ {
248+ from : publicDir ,
249+ to : outputDir ,
250+ toType : 'dir' ,
251+ noErrorOnMissing : true ,
252+ globOptions : {
253+ ignore : publicCopyIgnore
254+ }
255+ } ]
256+ }
257+
258+ if ( fs . existsSync ( publicDir ) ) {
259+ if ( isLegacyBundle ) {
260+ webpackConfig . plugin ( 'copy' ) . use ( PlaceholderPlugin , [ copyOptions ] )
261+ } else {
262+ webpackConfig . plugin ( 'copy' ) . use ( CopyWebpackPlugin , [ copyOptions ] )
263+ }
257264 }
258265 } )
259266}
You can’t perform that action at this time.
0 commit comments