Skip to content

doesn't work with file-loader #5438

@iamcco

Description

@iamcco

Bug report

Describe the bug

use file-loader but doesn't create the file to output directory when import file in _Document.jsx

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

git clone https://github.com/iamcco/test-file-loader.git
cd test-file-loader
yarn build

next.config.js

const withSass = require('@zeit/next-sass')

module.exports = withSass({
  pageExtensions: ['jsx'],
  webpack (config) {
    const { module = {} } = config
    return {
      ...config,
      module: {
        ...module,
        rules: [
          ...(module.rules || []),
          {
            test: /\.(png|woff|woff2|eot|ttf|gif|jpg|ico|svg)$/,
            loader: 'file-loader',
            options: {
              name: '[name]_[hash].[ext]',
              publicPath: `/_next/static/files`,
              outputPath: 'static/files'
            }
          }
        ]
      }
    }
  }
})

the favicon_1195c05fc68d40d09ebbf24865a55b91.ico files should create at .next/static/ but it create at .next/server/static/

Expected behavior

the favicon_1195c05fc68d40d09ebbf24865a55b91.ico files should create at .next/static/

Screenshots

image

System information

  • OS: [e.g. macOS]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions