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.

Undefined index when using copy/copydirectory

See original GitHub issue
  • Laravel Mix Version: 1.4.5
  • Node Version: v6.10.2
  • NPM Version: 3.10.10
  • OS: windows 10 xampp

Description:

Undefined index when using copy/copyDirectory and {{ mix() }}

Steps To Reproduce:

Create 2 folders in resources

/css/afolder/afile.css
/css/another/anotherfile.css

Copy the folders with the following:

mix.copy('resources/assets/css/', 'public/css', false);

or

mix.copyDirectory('resources/assets/css/', 'public/css');

The files are copied fine, but when using

{{ mix('css/afolder/afile.css') }}

or

{{ mix('css/anotherfolder/anotherfile.css') }}

It returns back

Undefined index: css/afolder/afile.css 
Undefined index: css/anotherfolder/anotherfile.css 

The folders exists:

public/css/afolder/afile.css
public/css/anotherfolder/anotherfile.css

Mix manifest just shows the following

{
    "/js/app.js": "/js/app.js?id=0eaf1649511b8f1c3fd9",
    "/css/app.css": "/css/app.css?id=a86d86d0b7edd1152cc6"
}

Full webpackmix file

let mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/assets/js/app.js', 'public/js');

mix.copy('resources/assets/js/', 'public/js', false);

mix.copy('resources/assets/css/', 'public/css', false);

mix.sass('resources/assets/sass/app.scss', 'public/css');

mix.version();
  

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
timoschwarzercommented, Oct 19, 2017

Reproduced.

2reactions
devcircuscommented, Feb 3, 2018

According to the documentation, you have to specify these ‘extra’ files or folders you may want versioned.

Versioning Extra Files

The mix.version() will automatically version any compiled JavaScript, Sass/Less, or combined files. However, if you’d also like to version extra files as part of your build, simply pass a path, or array of paths, to the method, like so:

mix.version([‘public/js/random.js’]);

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is an Undefined Index PHP Error? How to Fix It?
Undefined Index is a notice in PHP, and it is a choice of the developer to either ignore it or fix it.
Read more >
php - “Undefined index” when using $_GET - Stack Overflow
The error is because the $_GET['username'] var doesn't exist. You can execute var_dump($_GET) or print_r($_GET) to see all available values. You ...
Read more >
Notice: Undefined Index error in PHP - STechies
This error means that within your code, there is a variable or constant that has no value assigned to it. But you may...
Read more >
Notice: Undefined index - WordPress.org
Keep getting this error even I tried using Rookie theme. Please help. The page I need help with: [log in to see the...
Read more >
PHP Notice Undefined Index | Syntax | Working and Examples
Guide to PHP Notice Undefined Index. Here we discuss the introduction, syntax, and working of notice undefined index in PHP with examples.
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