Support different input source paths
markcellus opened this issue · comments
Hello! Great package!
I'm running into an issue: if I specify the input
path to be something other than src
, I get the following error:
app/**/*.js → build...
[!] Error: Invalid substitution "../app/app-router" for placeholder "[name]" in "output.entryFileNames" pattern, can be neither absolute nor relative path.
Error: Invalid substitution "../app/app-router" for placeholder "[name]" in "output.entryFileNames" pattern, can be neither absolute nor relative path.
Here is my rollup config
import multiInput from 'rollup-plugin-multi-input';
export default {
input: ['app/**/*.js'],
output: {
format: 'esm',
dir: 'dist'
},
plugins: [ multiInput()],
};
However, if I change my config to the following it works!
import multiInput from 'rollup-plugin-multi-input';
export default {
input: ['app/**/*.js'],
output: {
format: 'esm',
dir: 'dist'
},
plugins: [ multiInput({relative: 'app/'})],
};
Is relative
a required option when using the package? Seems like it would be beneficial to have it default to the root directory specified in input
if not supplied.
Hi @mkay581,
yes, the relative
option is always required with a default value of 'src'.
The main purpose of this plugin is to build libraries with multiple output entry points.
For example, a library with utility functions (for example lodash), how want to expose all the single functions in separated files so that project how use one functions don't have to import all of them.
I'm open to set the default of the relative
option to the root of the input string, but first, i want to discuss all the possible cases:
- what if
input: ['root1/**/*.js', 'root2/**/*.js']
, what would be therelative
value (root1 or root2)?
To resolve all the problem, I think the error should be ignored. If the path is not relative to relative
value, should be ignored and preserved as-is.
For example:
export default {
input: ['root1/**/*.js', 'root2/**/*.js']],
output: {
format: 'esm',
dir: 'dist'
},
plugins: [ multiInput()],
};
// should generate in dist
// dist/
// |-root1/files-in-root1
// |-root2/files-in-root2
Fixing this case will fix your initial problem. Not setting 'src' as the relative path, you wouldn't have an error but instead all your files into the 'dist/app' directory.
That seems reasonable to me! 👍
🎉 This issue has been resolved in version 1.0.3 🎉
The release is available on:
Your semantic-release bot 📦🚀
I seem to be encountering same problem but only on windows https://github.com/Gozala/web-blob/pull/6/checks?check_run_id=885838863