Webpack --watch - images in /assets/images not copied to dist

Hi,

I’m using Sage 9 alpha 4

I guess I’m a little confused as to how --watch is supposed to behave with images

I would expect images added to assets/images to be copied to the dist folder as is the case when building

it does not seem to be the case despite the following lines found in assets/build/config.js

copy: 'images/**/*',
config.watch.push(${path.basename(config.paths.assets)}/${config.copy});

and

new CopyGlobsPlugin({
      pattern: config.copy,
      output: `[path]${assetsFilenames}.[ext]`,
      manifest: config.manifest,
    }),

in /assets/build/webpack.config.js

so using App\asset_path('images/my-image.png) as the source for an image results in the image not being found as the path generated is //localhost:3000/app/themes/sage/dist/images/my-image.png

is it just me or is the whole dev config quite complex?

are there plans to comment it so it would be easier to understand what is going on? or maybe there are posts or discourse topics that I’m not aware of

many thanks in advance if someone find the time to help with this

Same. Filed an issue: Images added to template during Browsersync session not accessible · Issue #1794 · roots/sage · GitHub

Webpack is pretty complex, but we believe the benefits that come with it are worth it

1 Like

thanks,

this allows me to ask: would you rather have this sort of things appear in Discourse or Github?

As this is about Sage 9 alpha - I’d like to know what’s most convenient for the team

as for Webpack I understand it will beneficial, and that it’s powerful etc. I think, in good time, it would be verry nice to have the config files commented so it can be easily navigated and better understood by less experienced users - I would gladly help but right now I feel it’s still full of mysteries for me :slight_smile:

Hi!

If someone has the same problem in the latest Save version? I’ve tried to use Sage, but current webpack configuration doesn’t copy images from /resources/assets/images to /dist/images during --watch task.

Everything is ok when I run yarn build task, but it simply doesn’t work when --watch is enabled.

What can I do to fix that?