question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths and do not contain invalid characters

See original GitHub issue

I’m getting an error when I try to define a filename for the extract option.

postcss({
  extract: 'dist/test.css',
  …
})

v2.4.0:

[!] (plugin postcss) Error: The “fileName” or “name” properties of emitted files must be strings that are neither absolute nor relative paths and do not contain invalid characters, received “…/test.css”.

Works on v2.3.0.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:40 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
entenitycommented, Dec 17, 2021

It has not been fix this issue for 100 years

4reactions
halostatuecommented, Apr 29, 2020

This comment by @lukastaegert provides the full solution. What I had to do was:

13c05ebd 2020-04-29 | Fix issues with rollup-plugin-postcss (HEAD -> charge-purchase-history) [Austin Ziegler]

diff --git a/assets/rollup.config.js b/assets/rollup.config.js
index 1e976e0f..f1a365a1 100644
--- a/assets/rollup.config.js
+++ b/assets/rollup.config.js
@@ -60,13 +60,14 @@ const plugins = [
 ]
 
 function postcssPlugin(appType) {
-  return postcss({ extract: `${destination}/css/${appType}-app.css`, plugins: [autoprefixer] })
+  return postcss({ extract: `css/${appType}-app.css`, plugins: [autoprefixer] })
 }
 
 const employee = {
   input: 'src/employee-app.js',
   output: {
-    dir: `${destination}/js`,
+    dir: destination,
+    entryFileNames: 'js/[name].js',
     format: 'iife',
     sourcemap: !isProduction ? 'inline' : false,
   },
@@ -76,7 +77,8 @@ const employee = {
 const customer = {
   input: 'src/customer-app.js',
   output: {
-    dir: `${destination}/js`,
+    dir: destination,
+    entryFileNames: 'js/[name].js',
     format: 'iife',
     sourcemap: !isProduction ? 'inline' : false,
   },

This works perfectly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

rollup - How can I write CSS outside the JS destination folder
Error : The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths and do not...
Read more >
Impossible to extract CSS in a parent folder #265 - Issuehunt
The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths and do not contain invalid...
Read more >
TSConfig Reference - Docs on every TSConfig option
All relative paths found in the configuration file will be resolved relative to the configuration file they originated in. It's worth noting that...
Read more >
VS Code API | Visual Studio Code Extension API
VS Code API is a set of JavaScript APIs that you can invoke in your Visual Studio Code extension. This page lists all...
Read more >
GNU make
Searching other directories for source files. • Phony Targets, Using a target that is not a real file's name. • Force Targets, You...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found