Hi there.
There is any way to include jsx from vendor folder to my block for example?
Currently i’v got Module parse failed: Unexpected token
No any problems when this file is in the theme folder.
Thanks
Hi there.
There is any way to include jsx from vendor folder to my block for example?
Currently i’v got Module parse failed: Unexpected token
No any problems when this file is in the theme folder.
Thanks
Yes there is. But please put some more effort into creating topics and read our guidelines.
You’ve gotta post some code.
You’ve already been pointed to this topic a few times, so please make more of an effort moving forward if you’re looking for help:
Hi Ben
Hi, @ben
for example
theme-name/resources/scripts/editor:
roots.register.blocks(
./editor/);
theme-name/resources/scripts/editor/blocks/container.block.js:
import {InspectorControls, InnerBlocks} from '@wordpress/block-editor';
import BlockOptions from "../../../../../../../../vendor/yarovikov/gutengood/resources/src/scripts/editor/components/block-options";
export const name = 'gutengood/container'
export const title = 'Container'
export const category = 'common'
vendor/yarovikov/gutengood/resources/src/scripts/editor/components/block-options:
import {InspectorControls} from '@wordpress/block-editor';
export default function BlockOptions() {
return (
<InspectorControls>
</InspectorControls>
)
}
Module parse failed: Unexpected token (8:4)
│ │ File was processed with these loaders:
│ │ * …/node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
│ │ You may need an additional loader to handle the result of these loaders.
│ │ | export default function BlockOptions() {
│ │ | return (
│ │ >
│ │ |
│ │ | )
i’m still not sure that’s good idea to import from vendor dir, but i wonder is this possible?