Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving files in watch mode changes paths in assets file #115

Closed
Monokai opened this issue Dec 10, 2020 · 7 comments
Closed

Saving files in watch mode changes paths in assets file #115

Monokai opened this issue Dec 10, 2020 · 7 comments
Assignees

Comments

@Monokai
Copy link

Monokai commented Dec 10, 2020

The problem

I'm working on a project that runs webpack in watch mode using the devServer config. When I start the project, everything works fine and all the paths in the resulting assets manifest are correct. Whenever I change my code and save a random JS file, the assets paths are changed.

Version 3 didn't show this behavior, even with Webpack 5.

Technical details

paths on first run:

"images/image.svg": "http://localhost:3000/images/image.svg"

after a save of a random JS file:

"image.svg": "http://localhost:3000/images/image.svg"

You can see that outputPath seems to be discarded.

Webpack version

5.10.0

Webpack config

{
	test   : /\.svg/,
	loader : 'file-loader',
	options: {
		name      : '[name]-[contenthash:16].[ext]',
		outputPath: 'images',
		esModule  : false
	}
}

new WebpackAssetsManifest({
	output              : 'assets.json',
	space               : 2,
	writeToDisk         : true,
	publicPath          : true,
	entrypoints         : true,
	entrypointsUseAssets: true
})

Operating system

Docker node:14-alpine

@mpg-tomoya-komiyama
Copy link

Same here with webpack-assets-manifest@~5 and ~4.
It works fine with ~3.

@dkrnl
Copy link

dkrnl commented Dec 25, 2020

same issue:

  "og-image.png": {
    "src": "/img/og-image.png",
    "integrity": "..."
  },

@Stanzilla
Copy link

Stanzilla commented Dec 28, 2020

Same here on webpack v4 and webpack-assets-manifest@~4

@webdeveric webdeveric self-assigned this Dec 28, 2020
@webdeveric
Copy link
Owner

@Monokai Can you install the plugin from my watch-mode-update branch and try again?

npm install webdeveric/webpack-assets-manifest#watch-mode-update

@mpg-tomoya-komiyama
Copy link

watch-mode-update branch

@webdeveric
It seems to be fine in my project👍

@Monokai
Copy link
Author

Monokai commented Jan 5, 2021

@webdeveric Seems to be working. Thanks!

webdeveric added a commit that referenced this issue Jan 12, 2021
- Updated hooks for watch mode
- Use public path with entrypoints
- Updated dependencies
webdeveric added a commit that referenced this issue Jan 12, 2021
- Updated hooks for watch mode
- Use public path with entrypoints
- Updated dependencies
@webdeveric
Copy link
Owner

@Monokai @mpg-tomoya-komiyama I've published an updated version to npm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants