Missing webpack context rules for requiring lazy messages file
See original GitHub issueVersion
nuxt-i18n: 6.20.1 nuxt: 2.15.0
Nuxt configuration
mode:
- universal
- spa
Nuxt-i18n configuration
i18n: { locales: [{ code: “fr”, file: “fr.js” }], langDir: “lang/lazyDir”, defaultLocale: “fr”, lazy: true }
Reproduction Link
https://codesandbox.io/s/romantic-hamilton-o1ijf?file=/lang/README.md
Steps to reproduce
Insert a .md file inside the folder where lazy files are loaded (aka langDir property)
What is Expected?
No webpack warnings for unhandled files.
What is actually happening?
Webpack wants me to handle the md files. It throws this warning
./lang/lazyDir/README.md 1:5
Module parse failed: Unexpected token (1:5)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Thoughts
Maybe it’s because of require context who parse too much file extensions. A quick fix is to keep the langDir as light as possible without md files, and require messages from another folder.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Missing webpack context rules for requiring lazy messages file
Maybe it's because of require context who parse too much file extensions. A quick fix is to keep the langDir as light as...
Read more >To v5 from v4 - webpack
This guide aims to help you migrating to webpack 5 when using webpack directly. If you are using a higher level tool to...
Read more >Module Federation - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >DevServer - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >MiniCssExtractPlugin - webpack
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { plugins: [new MiniCssExtractPlugin()], module: { rules: [ { test: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll only try to load files with
js
,ts
, andjson
extensions. Let me know if you can think of any other that should be included.Sorry about that. Addressed with 01f92ae72ba2a37cda2be119f618751ab7dbf20b and released in https://github.com/nuxt-community/i18n-module/releases/tag/v6.20.3
I will consider that if there is really a need for it (that is if someone complains again).