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

webpack/manifest.json doesn't get updated when add an image in assets folder #509

Closed
brightgems opened this issue Jun 22, 2019 · 1 comment · Fixed by #535
Closed

webpack/manifest.json doesn't get updated when add an image in assets folder #509

brightgems opened this issue Jun 22, 2019 · 1 comment · Fixed by #535

Comments

@brightgems
Copy link

Tested using latest version with command cookiecutter https://github.com/cookiecutter-flask/cookiecutter-flask/.

the problem is when add an image in assets folder, then execute npm run build, I can find that compiled in webpack/manifest.json. As a result, asset_url_for('img path') in jinjia template and cannot find its path.

after dive into ManifestRevisionPlugin, I found that it will prevent from add from stat into json file when the length of reason property is not 0. the reason text prompt optimizationBailout: [ 'ModuleConcatenation bailout: Module is not an ECMAScript module' ]

below is stat text.

css ./node_modules/_css-loader@3.0.0@css-loader/dist/cjs.js!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js!./assets/css/style.less,false
{ id: '',
  identifier:
   'css D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_css-loader@3.0.0@css-loader\\dist\\cjs.js!D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_less-loader@5.0.0@less-loader\\dist\\cjs.js!D:\\ulwork\\product_innovation\\ec\\trendash\\assets\\css\\style.less 0',
  name:
   'css ./node_modules/_css-loader@3.0.0@css-loader/dist/cjs.js!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js!./assets/css/style.less',
  index: 18,
  index2: 16,
  size: 2351,
  cacheable: undefined,
  built: false,
  optional: false,
  prefetched: false,
  chunks: [ 0 ],
  issuer:
   'D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_mini-css-extract-plugin@0.7.0@mini-css-extract-plugin\\dist\\loader.js??ref--4-0!D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_css-loader@3.0.0@css-loader\\dist\\cjs.js!D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_less-loader@5.0.0@less-loader\\dist\\cjs.js!D:\\ulwork\\product_innovation\\ec\\trendash\\assets\\css\\style.less',
  issuerId: 15,
  issuerName: './assets/css/style.less',
  issuerPath:
   [ { id: 15,
       identifier:
        'D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_mini-css-extract-plugin@0.7.0@mini-css-extract-plugin\\dist\\loader.js??ref--4-0!D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_css-loader@3.0.0@css-loader\\dist\\cjs.js!D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_less-loader@5.0.0@less-loader\\dist\\cjs.js!D:\\ulwork\\product_innovation\\ec\\trendash\\assets\\css\\style.less',
       name: './assets/css/style.less',
       profile: undefined } ],
  profile: undefined,
  failed: false,
  errors: 0,
  warnings: 0,
  assets: [],
  reasons:
   [ { moduleId: 15,
       moduleIdentifier:
        'D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_mini-css-extract-plugin@0.7.0@mini-css-extract-plugin\\dist\\loader.js??ref--4-0!D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_css-loader@3.0.0@css-loader\\dist\\cjs.js!D:\\ulwork\\product_innovation\\ec\\trendash\\node_modules\\_less-loader@5.0.0@less-loader\\dist\\cjs.js!D:\\ulwork\\product_innovation\\ec\\trendash\\assets\\css\\style.less',
       module: './assets/css/style.less',
       moduleName: './assets/css/style.less',
       type: undefined,
       explanation: undefined,
       userRequest: undefined } ],
  usedExports: true,
  providedExports: null,
  optimizationBailout:
   [ 'ModuleConcatenation bailout: Module is not an ECMAScript module' ],
  depth: 2 }
@lamphej
Copy link

lamphej commented Jul 22, 2019

@brightgems , if you are still facing this problem, it looks like its happening because of a change in webpack 4. Following this comment nickjj/manifest-revision-webpack-plugin#49 (comment) I was able to get it working. Namely adding the extensionsRegex: /\.(jpe?g|png|gif|svg)$/i, to your ManifestRevisionPlugin

extant1 pushed a commit to extant1/cookiecutter-flask that referenced this issue Aug 11, 2019
Fix for cookiecutter-flask#509 courtesy of lamphej and brightgems.
jamescurtin pushed a commit that referenced this issue Aug 11, 2019
Fix for #509 courtesy of lamphej and brightgems.
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

Successfully merging a pull request may close this issue.

2 participants