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

'BundleAll' method causes /*** IMPORTED FILE NOT FOUND ***/ to be outputted #98

Open
owenjs opened this issue Nov 14, 2020 · 2 comments

Comments

@owenjs
Copy link

owenjs commented Nov 14, 2020

I have a use case for the 'BundleAll' method, so I'm using the same technique as suggested in #67.

However, the bundled files have the comment below appear multiple times.

/*** IMPORTED FILE NOT FOUND ***/
/*** --- ***/

It looks like the @imports which are causing this comment are the ones included in all of the files being bundled.
Although one bundled file manages to output the bundled content for the import and the others do not.
For example, I'm importing _variables.scss in all the files.

To fix this I'm instead initialising the Bundler class each time I iterate over my filesToBundle array:

const filesToWrite = await Promise.all(filesToBundle.map(async fileToBundle => {
    // Initialise Bundler
    const bundler = new Bundler(undefined, projectDirectory);
    // Bundle the File
    return await bundler.bundle(fileToBundle);
}));

This way the files bundle as expected.

I thought I'll mention it as I'm not sure if this is intended, if so #67 is the wrong replacement for 'BundleAll' for my use case.

Package version: v3.1.2
Node version: v14.10.0
OS: Windows

@owenjs owenjs changed the title Bundle Multiple Files causes /*** IMPORTED FILE NOT FOUND ***/ to the outputted 'BundleAll' method causes /*** IMPORTED FILE NOT FOUND ***/ to the outputted Nov 14, 2020
@JSMike
Copy link

JSMike commented Jul 16, 2021

I ran into this using Builder.bundle. Stepping through the issue I found that the path resolver for includePaths doesn't work if you set up your project using scss barrels. If you have a foo/index.scss and try to @import 'foo' it will try to resolve foo.scss and not check if foo is a directory with an index.scss. You'll either need to add the full path to your imports (@import 'foo/index') or flatten your directory structure until this is resolved.

@PhiLhoSoft
Copy link

PhiLhoSoft commented Jan 13, 2022

I got this problem in a project where I replaced the old, deprecated (in dart-sass) @import '~package-name/index'; referencing a barrel file with only @imports, with a more modern @import 'package-name'; .
I had to revert the changes, keeping both the tilde and the /index.
Using 3.1.2.

@owenjs owenjs changed the title 'BundleAll' method causes /*** IMPORTED FILE NOT FOUND ***/ to the outputted 'BundleAll' method causes /*** IMPORTED FILE NOT FOUND ***/ to by outputted Apr 4, 2023
@owenjs owenjs changed the title 'BundleAll' method causes /*** IMPORTED FILE NOT FOUND ***/ to by outputted 'BundleAll' method causes /*** IMPORTED FILE NOT FOUND ***/ to be outputted Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants