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

New Asset(s) Do Not Gets Updated in Webpack Stats #11

Open
gdad-s-river opened this issue Nov 13, 2018 · 4 comments
Open

New Asset(s) Do Not Gets Updated in Webpack Stats #11

gdad-s-river opened this issue Nov 13, 2018 · 4 comments

Comments

@gdad-s-river
Copy link

gdad-s-river commented Nov 13, 2018

The new file gets generated fine and gets served well ( over local dev server ). But the file does not seem to get updated in the webpack stats in the assets. I check this using assets-webpack-plugin.

I googled around if it was a webpack thingy, but couldn't pin point. Perhaps someone could help?

@markshapiro

@markshapiro
Copy link
Owner

markshapiro commented Nov 15, 2018

do you mean the file names don't get updated if changed? what do you store with stats file?

@gdad-s-river
Copy link
Author

gdad-s-river commented Nov 15, 2018

This happened — 

I used webpack-merge-and-include-globally and saw in my console of webpack that my new file has been generated (yeahScience.js)

screen shot 2018-11-15 at 3 34 29 pm

But when I use assets-webpack-plugin to see if it has been added by the webpack in the webpack graph, it hasn't been added — 

screen shot 2018-11-15 at 3 36 28 pm

I'm dependent on the bundle generated by webpack-merge-and-include-globally being added to webpack graph this way — 

  • the project I'm working for is using webpack-isomorphic-tools

  • The project uses webpackIsomorphic.assets() to dynamically access generated bundle file's name in an express handler js file, which is intended to be served for a particular route. Hence I need the generated file to added to the webpack graph.

Makes sense?

@arihantverma
Copy link

arihantverma commented Nov 15, 2018

I tried a bare bones webpack setup to check this.

// src/1.js
const a = 'a';

// src/2.js
const b = 'b';

// src/index.js
const index = 'index'
// package.json
{
  "name": "webpack-concat-plugin-webpack-1-test",
  "version": "1.0.0",
  "description": "",
  "main": "src/index.js",
  "dependencies": {
    "webpack": "^1.15.0",
    "webpack-dev-server": "^3.1.10"
  },
  "devDependencies": {
    "assets-webpack-plugin": "^3.9.7",
    "webpack-merge-and-include-globally": "^2.1.5"
  },
  "scripts": {
    "build": "webpack"
  },
  "author": "",
  "license": "ISC"
}
// webpack.config.js

const AssetsPlugin = require('assets-webpack-plugin');
const MergeIntoSingleFilePlugin = require('webpack-merge-and-include-globally');

var assetsPluginInstance = new AssetsPlugin();

module.exports = {
  entry: './src/index.js',
  output: {
    filename: './bundle.js'
  },
  plugins: [
    new AddAssetPlugin('file.js', `

    new MergeIntoSingleFilePlugin({
      files: {
        'yeahScienceMath.js': [
          './src/*.js'
        ],
      },
    }),
    assetsPluginInstance
  ]
};

on running webpack webpack-assets.json comes out to be :

{"main":{"js":"./bundle.js"},"":{"js":["yeahScienceMath.js"]}}

I have no idea why it isn't working in my project 😅

@markshapiro
Copy link
Owner

markshapiro commented Nov 19, 2018

does AddAssetPlugin create asset entry for you in the first example?

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

3 participants