Comments (9)
Fixed it. Now i can see the form editor.
The fix was pretty obvious this time around. I forgot to actually use the loader on form-render, that's on me.
extend(config) {
config.module.rules.push({
test: /form-(builder|render)\.min\.js$/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins:['@babel/plugin-transform-modules-commonjs', '@babel/plugin-transform-runtime', '@vue/babel-plugin-transform-vue-jsx', '@babel/plugin-syntax-jsx', '@babel/plugin-proposal-private-property-in-object', '@babel/plugin-transform-classes']
},
}
]
})
config.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
})
}
from formbuilder.
I don't use Vue, however looking at your code I would suspect you are reloading jQuery again with the import jQuery (after including it first globally with the script src tag. You need to import jquery-ui sortable and require formBuilder after importing jQuery
Please see previous issue #789
@kevinchappell provided a sandbox demo https://codesandbox.io/p/sandbox/n91zzl4vpp
Specifically https://codesandbox.io/p/sandbox/n91zzl4vpp?file=%2Fsrc%2Fcomponents%2FformBuilder.vue%3A24%2C10
window.$ = window.jQuery = require('jquery');
require('jquery-ui-sortable'); //or import 'jquery-ui/ui/widgets/sortable';
require('formBuilder');
More info on StackOverflow
https://stackoverflow.com/questions/51648926/vue2-jquery-jquery-ui
If you get it working please consider submitting a PR for a documentation page
from formbuilder.
Alright so i have been testing this, using the provided code in the sandbox, requiring jquery-ui-sortable, formBuilder, and form-render (not sure if this is needed). It does not give me the type error anymore, but i receive a different one now, it says:
ERROR in ./node_modules/formBuilder/dist/form-builder.min.js 2:144575
Module parse failed: Unexpected token (2:144575)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders...
for formBuilder, and something similar for the form-render.
Not sure if i have missed something with the loaders.
the code right now is:
<template>
<v-container fluid>
<div id="fb-editor"></div>
</v-container>
</template>
<script>
import jQuery from 'jquery'
window.$ = window.jQuery = require('jquery');
require('jquery-ui-sortable')
require('formBuilder')
require('formBuilder/dist/form-render.min.js')
export default {
mounted() {
jQuery(function($) {
$(document.getElementById('fb-editor')).formBuilder();
});
}
}
</script>
I have babel-loader 8.2.5 and babel-core 6.26.3 installed.
from formbuilder.
UPDATE:
I fixed the "you may need an appropiate loader" error by configuring the nuxt.config.js properly, inside build for form-builder.min.js (not for form-render):
config.module.rules.push({
test: /form-builder\.min\.js$|form-builder\.js$/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['babel-preset-env']
}
}
]
})
However, i now have another error, one that says:
ERROR in ./node_modules/formBuilder/dist/form-builder.min.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: /opt/lampp/htdocs/thani/dirisalud-front/node_modules/formBuilder/dist/form-builder.min.js: path.inShadow is not a function
So now i'm stuck at that one.
from formbuilder.
I would guess these are all babel-loader errors now, likely need to install some plugins
https://stackoverflow.com/questions/54298816/how-to-fix-path-inshadow-is-not-a-function-when-transpiling-code-using-grunt
WebReflection/babel-plugin-transform-builtin-classes#16
from formbuilder.
Installed a few plugins:
plugins:['babel-plugin-transform-es2015-modules-commonjs', '@babel/plugin-transform-runtime', 'babel-plugin-transform-vue-jsx', '@babel/plugin-syntax-jsx', '@babel/plugin-proposal-private-property-in-object', '@babel/plugin-transform-classes']
with this, the path.inShadow error is gone.
The "you may need an appropiate loader" error remains for form-render.
Maybe i'm missing a specific plugin?
from formbuilder.
im a bit confused why any babel-loader would be needed for formBuilder or formRender. is your custom babel config not excluding node_modules?
from formbuilder.
I don't think so, no. This is the extent of my loader configuration in the nuxt config file:
build: {
extend(config) {
config.module.rules.push({
test: /form-builder\.min\.js$|form-builder\.js$/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins:['babel-plugin-transform-es2015-modules-commonjs', '@babel/plugin-transform-runtime', 'babel-plugin-transform-vue-jsx', '@babel/plugin-syntax-jsx', '@babel/plugin-proposal-private-property-in-object', '@babel/plugin-transform-classes']
}
}
]
})
config.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
})
},
},
Not sure what to say, if i didnt have babel loader, it would just tell me i need a loader for those files (which it doesnt anymore for formBuilder, but it does for formRender).
from formbuilder.
Glad you got it sorted it out 👍
from formbuilder.
Related Issues (20)
- Text Area Component allows input of negative value in the Rows field HOT 2
- When Select component only has x2 options a non-functioning Remove Element button is still present HOT 1
- Can I provide custom order(alphabetical) to the fields? HOT 6
- How to custom label header ? HOT 2
- Adding field type button - Label not set HOT 2
- form-builder.js clears inputted data for tinymce fields when editing the field's options
- Required Checkbox Group - Other with text box - not validating blank value
- Form builder questions - Issue with data are not saving while edit/update the form builder questions HOT 4
- BeforeRemove event HOT 2
- How to keep the default class as className. HOT 1
- How to scroll to edit panels when opening them? HOT 5
- How to create a checkbox group with monetry value to each checkbox. HOT 2
- How to make bootstrap classes not disappear when removing a field from a row and putting it in an empty place HOT 8
- Strings set in a custom control that use custom lang file show as undefined when first rendered but work on second render HOT 9
- Labels for fields and replaceFields options do not use localized strings HOT 4
- Form render error with custom controls HOT 4
- npm plugin system HOT 1
- How to custom multiple input in one field and set the JSON output is array or object? HOT 2
- When Double-click trumbowyg area will open the Edit issue HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formbuilder.