iampava / imagemin-webp-webpack-plugin

Webpack plugin which converts images to the WebP format while also keeping the original files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

With Webpacker does not pickup any assets

Szymon-dziewonski opened this issue · comments

Hello, my issue is that it seems like plugin does not pick up any files at all

Can maybe someone give me a direction what should be done to make it work ?

environment.js

const { environment } = require('@rails/webpacker')
const typescript = require('./loaders/typescript')
const ImageminWebpWebpackPlugin = require('imagemin-webp-webpack-plugin');

environment.loaders.append('typescript', typescript)
environment.plugins.prepend('ImageminWebpWebpackPlugin', new ImageminWebpWebpackPlugin({
  silent: false,
  detailedLogs: true,
}));

module.exports = environment

webpacker.yml

# Note: You must restart bin/webpack-dev-server for changes to take effect

default: &default
  source_path: app/javascript
  source_entry_path: packs
  public_root_path: public
  public_output_path: packs
  cache_path: tmp/cache/webpacker
  check_yarn_integrity: false
  webpack_compile_output: false

  # Additional paths webpack should lookup modules
  # ['app/assets', 'engine/foo/app/assets']
  resolved_paths: []

  # Reload manifest.json on all requests so we reload latest compiled packs
  cache_manifest: false

  # Extract and emit a css file
  extract_css: false

  static_assets_extensions:
    - .jpg
    - .jpeg
    - .png
    - .gif
    - .tiff
    - .ico
    - .svg
    - .eot
    - .otf
    - .ttf
    - .woff
    - .woff2

  extensions:
    - .tsx
    - .ts
    - .elm
    - .mjs
    - .js
    - .sass
    - .scss
    - .css
    - .module.sass
    - .module.scss
    - .module.css
    - .png
    - .svg
    - .gif
    - .jpeg
    - .jpg

development:
  <<: *default
  compile: false

  # Verifies that versions and hashed value of the package contents in the project's package.json
  check_yarn_integrity: true

  # Reference: https://webpack.js.org/configuration/dev-server/
  dev_server:
    https: false
    host: localhost
    port: 3035
    public: localhost:3035
    hmr: false
    # Inline should be set to true if using HMR
    inline: true
    overlay: true
    compress: true
    disable_host_check: true
    use_local_ip: false
    quiet: false
    headers:
      "Access-Control-Allow-Origin": "*"
    watch_options:
      ignored: "**/node_modules/**"

test:
  <<: *default
  compile: true

  # Compile test packs to a separate directory
  public_output_path: packs-test

production:
  <<: *default

  # Production depends on precompilation of packs prior to booting for performance.
  compile: false

  # Extract and emit a css file
  extract_css: false

  # Cache manifest.json for performance
  cache_manifest: true

From what I understand plugin picksup manifest.json, but my manifest does not contain any image paths

{
  "application.js": "/packs/js/application-4f86e63fe47cebe0b740.js",
  "application.js.map": "/packs/js/application-4f86e63fe47cebe0b740.js.map",
  "bugsnag.js": "/packs/js/bugsnag-52233be3810a1eeb97f2.js",
  "bugsnag.js.map": "/packs/js/bugsnag-52233be3810a1eeb97f2.js.map",
  "entrypoints": {
    "application": {
      "js": [
        "/packs/js/application-4f86e63fe47cebe0b740.js"
      ],
      "js.map": [
        "/packs/js/application-4f86e63fe47cebe0b740.js.map"
      ]
    },
    "bugsnag": {
      "js": [
        "/packs/js/bugsnag-52233be3810a1eeb97f2.js"
      ],
      "js.map": [
        "/packs/js/bugsnag-52233be3810a1eeb97f2.js.map"
      ]
    },
    "hubspot": {
      "js": [
        "/packs/js/hubspot-451376f8d7d5650612ca.js"
      ],
      "js.map": [
        "/packs/js/hubspot-451376f8d7d5650612ca.js.map"
      ]
    },
    "loadmaterialicons": {
      "js": [
        "/packs/js/loadmaterialicons-debeb6fe789454325885.js"
      ],
      "js.map": [
        "/packs/js/loadmaterialicons-debeb6fe789454325885.js.map"
      ]
    }
  },
  "hubspot.js": "/packs/js/hubspot-451376f8d7d5650612ca.js",
  "hubspot.js.map": "/packs/js/hubspot-451376f8d7d5650612ca.js.map",
  "loadmaterialicons.js": "/packs/js/loadmaterialicons-debeb6fe789454325885.js",
  "loadmaterialicons.js.map": "/packs/js/loadmaterialicons-debeb6fe789454325885.js.map"
}

Any ideas would be appreciate, thanks

Hey!

Check out this issue, seems to be related to Webpacker as well. Maybe you can find some info there: #18

Closing this due to inactivity