Skip to content

Creating Extra 'public' folders with images inside components #7

@RDP07

Description

@RDP07

So the way my app is structured is any component that needs images has a nested /images folder inside each component. I am using the babel-plugin-file-loader to extract the images and move them into the /public/images at the root of the project.

This is my .babelrc config:

  "presets": [
    "env",
    "react"
  ],
  "plugins": [
    [ "babel-plugin-styled-components",
      {
        "ssr": true,
        "displayName": true
      }
    ],
    "transform-class-properties",
    "transform-decorators",
    "transform-react-constant-elements",
    "transform-react-inline-elements",
    [ "babel-plugin-webpack-alias", { "config": "./config/build/webpack.config.js" } ],
    [
      "file-loader",
      {
        "name": "[name].[ext]",
        "extensions": ["png", "jpg", "jpeg", "gif", "svg"],
        "publicPath": "/images",
        "outputPath": "/public/images",
        "context": "/"
      }
    ]
  ]
}

My issue is that every time the app builds it creates a /public/images/** directory inside any components that it is pulling the images from. All I want it to do is create the /public/images/** at root not inside each components folder that has an images folder

I have tried messing with the context, publicPath, and outputPath and I can't get it to stop making a new /public folder inside my component folders. I am not sure is this a bug or do I have something configured incorrectly??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions