Commit e6ff4761 authored by Rafał Ruciński's avatar Rafał Ruciński Committed by Tim Neutkens

Use a more appropriate regexp for removing hash from a filename (#4510)

Fixes one of the problems described in #4433.

The old regexp was removing everything after a hyphen, so with a chunk name like so:

```
chunks/path-to-a-file-[hash].js
```

the saved chunk name was

```
chunks/path
```

This caused problems, because webpack by default changes `/` to `-` in chunk names generated e.g. by ``import(`foo/${bar}`)``.

After this change the chunk name will be

```
chunks/path-to-a-file
```
parent 631e6c7e
...@@ -13,7 +13,7 @@ export function getAvailableChunks (distDir) { ...@@ -13,7 +13,7 @@ export function getAvailableChunks (distDir) {
chunkFiles.forEach(filename => { chunkFiles.forEach(filename => {
if (/\.js$/.test(filename)) { if (/\.js$/.test(filename)) {
const chunkName = filename.replace(/-.*/, '') const chunkName = filename.replace(/-[^-]*/, '')
chunksMap[chunkName] = filename chunksMap[chunkName] = filename
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment