From fa5bb609ecbdef900a4bc38aaae087957dbf004f Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Wed, 20 Dec 2023 18:51:04 +0100 Subject: [PATCH] (refactor) use build.transpile inside of nuxt.config.js for esm-only dependencies https://v2.nuxt.com/docs/configuration-glossary/configuration-build#transpile --- nuxt.config.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/nuxt.config.js b/nuxt.config.js index 76289ab74..33c32f9f3 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -239,12 +239,12 @@ export default { use: 'yaml-loader', }); config.module.rules.push({ - test: /.js/, + test: /\.js$/, loader: 'string-replace-loader', options: { // To load .json files inside of .js files of type module in a node environment, // one has to either load from the filesystem or via a created require(). - // While a load vie filesystem is very unfriendly to webpack, + // While a load via filesystem is very unfriendly to webpack, // the explicit creation of a require() function can be removed. // This probably gets replaced in the future by a `import from with { type: 'json' }` // statement, which is currently (2023-12) experimental in node and not well supported in webpack. @@ -261,12 +261,8 @@ export default { ], }, }); - config.module.rules.push({ - test: /\.mjs$/, - include: /node_modules/, - type: 'javascript/auto', - }); }, + transpile: ['markdown-it'], }, env: { ENV: process.env.ENV,