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

doesn't work with file-loader #5438

Closed
iamcco opened this issue Oct 12, 2018 · 2 comments
Closed

doesn't work with file-loader #5438

iamcco opened this issue Oct 12, 2018 · 2 comments

Comments

@iamcco
Copy link

iamcco commented Oct 12, 2018

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]
@timneutkens
Copy link
Member

_document is just for creating the html structure. Use _app.js for app logic.

@iamcco
Copy link
Author

iamcco commented Oct 15, 2018

@timneutkens if i move to _app,the file will be create twice

.next/server/static/files
.next/static/files

what's the difference

@lock lock bot locked as resolved and limited conversation to collaborators Oct 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants