shellscape / webpack-manifest-plugin

webpack plugin for generating asset manifests
MIT License
1.44k stars 184 forks source link

assets file map incorrect #70

Closed p2227 closed 7 years ago

p2227 commented 7 years ago

clone this repository https://github.com/p2227/react-starter-kit/

run

npm i
npm run build-stats

i will got the manifest.json

{
  "2f751285.png": "logo-small.png",
  "8844262b.png": "logo-small@2x.png",
  "about.js": "about.73e7ed35.chunk.js",
  "about.js.map": "about.73e7ed35.chunk.js.map",
  "admin.js": "admin.82b2d7f7.chunk.js",
  "admin.js.map": "admin.82b2d7f7.chunk.js.map",
  "client.js": "client.30fe54c9.js",
  "client.js.map": "client.30fe54c9.js.map",
  "contact.js": "contact.3e31ace8.chunk.js",
  "contact.js.map": "contact.3e31ace8.chunk.js.map",
  "home.js": "home.88e579db.chunk.js",
  "home.js.map": "home.88e579db.chunk.js.map",
  "login.js": "login.a43f9088.chunk.js",
  "login.js.map": "login.a43f9088.chunk.js.map",
  "not-found.js": "not-found.1b11123c.chunk.js",
  "not-found.js.map": "not-found.1b11123c.chunk.js.map",
  "privacy.js": "privacy.a840f532.chunk.js",
  "privacy.js.map": "privacy.a840f532.chunk.js.map",
  "register.js": "register.f35a0a4f.chunk.js",
  "register.js.map": "register.f35a0a4f.chunk.js.map",
  "vendor.js": "vendor.84747063.js",
  "vendor.js.map": "vendor.84747063.js.map"
}

but i expect

   "logo-small.png": "2f751285.png",
  "logo-small@2x.png": "8844262b.png",

node v8.2.1 , mac 10.12.5

mastilver commented 7 years ago

Hi @p2227, Thank you for the detailed issue :)

It definitely looks wrong, I will investigate it Is that something that was introduced by a recent release?

etrepum commented 7 years ago

@mastilver v1.2.1 does not have this problem., this regression is new in v1.3.0.

bat-bold commented 7 years ago

Starting from v1.3.0, no longer works with inline-chunk-manifest-html-webpack-plugin

Usage example:

const ManifestPlugin = require ( 'webpack-manifest-plugin' );
const InlineChunkManifestHtmlWebpackPlugin = require ( 'inline-chunk-manifest-html-webpack-plugin' );

...
plugins: [
    new InlineChunkManifestHtmlWebpackPlugin ( {
      manifestPlugins : [
        new ManifestPlugin ( { publicPath } ),
      ],
      manifestVariable: 'manifest'
    } ),
  ]
...
p2227 commented 7 years ago

@mastilver this is my first time using webpack-manifest-plugin.

frequin commented 7 years ago

Hi @mastilver, it looks like the default manifest reduce function is assigning the wrong way by doing : manifest[file.name] = file.path; instead of manifest[file.path] = file.name;

It comes from #66 : https://github.com/danethurber/webpack-manifest-plugin/pull/66/files#diff-f85c36a1cc8952fb5e6fc7200a89ceaaR138

frequin commented 7 years ago

@mastilver quick fix PR : #71

mastilver commented 7 years ago

@Batbold-Gansukh Opened an issue there #72, will fix asap

mastilver commented 7 years ago

1.3.1 released :)