plone / volto

React-based frontend for the Plone Content Management System
https://demo.plone.org/
MIT License
490 stars 664 forks source link

Volto 7 does not support namespaces in add-ons, build fails with "Module parse failed: Unexpected character '@' (6:7)" #1657

Closed tisto closed 4 years ago

tisto commented 4 years ago

We upgraded one of our Volto projects from Volto 6 to 7 and since the upgrade, we are unable to load one of our internal add-ons. We use namespaces such as "@kitconcept/volto-addon":


$ razzle build
Creating an optimized production build...
Compiling client...
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
Failed to compile.

/tmp/tmp-19481NEsu8Im7W2IZ.js 6:7
Module parse failed: Unexpected character '@' (6:7)
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
| */
| 
> import @kitconcept/voltoBlocks from '@kitconcept/volto-addon';
| 
| const load = (config) => {
 @ ./node_modules/@plone/volto/src/config/index.js 20:0-56 77:9-32
 @ ./src/config.js
 @ ./node_modules/@plone/volto/src/start-client.jsx
 @ ./src/client.js

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Fixing this is crucial because the Volto core package uses namespaces and future core add-ons will do the same.

tisto commented 4 years ago

@tiberiuichim could you have a look at this, please? This currently prevents us from upgrading to Volto 7 and moving forward.