vue-form-generator
vue-form-generator copied to clipboard
Fix fieldComponents exposure
Exposing fieldComponents was broken because we were exporting named
exports in the fieldsLoader.js
while we were importing as though it was exported as a default export.
- Please check if the PR fulfills these requirements
- [ ] The commit message follows our guidelines
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
- What kind of change does this PR introduce? (Bug fix, feature, docs update, ...) Bug fix
- What is the current behavior? (You can also link to an open issue here)
In export (utils/fieldsLoader.js
):
module.exports = fieldComponents;
In import time inside (index.js
)
const fieldComponents = require("./utils/fieldsLoader").default;
This meant that this code would not be doing the right thing.
import { fieldComponents } from 'vue-form-generator'
Because
// fieldComponents === undefined; because we imported it as if it was a default export
I'm sure this is not intended.
fieldComponents
would always be undefined
, which isn't very nice because for some
usecases, you might actually want to have access to the components.
- What is the new behavior (if this is a feature change)?
Changes the importing to
const fieldComponents = require("./utils/fieldsLoader");
- Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No breaking changes introduced.
- Other information:
Nothing else to add.
Coverage remained the same at 89.979% when pulling c7448b3c79b1814ea73b94ca1638a86cba3573e4 on muschottkey:master into 721a4eebbde77040a1318e60aa9ef21229bbcf99 on vue-generators:master.
I am also experiencing this as an issue - namely, i am building another component that wraps around FieldCleave, but I have no way of importing FieldCleave directly except perhaps by adding all the necessary dependencies that VueFormGenerator uses internally. Ideally, I'd like to be able to grab the built definition off of fieldComponents but as mentioned above, fieldComponents is undefined because it is imported / exported incorrectly.