For supporting dynamic import syntax, I installed babel-plugin-syntax-dynamic-import
package and added a .babelrc
to theme:
{
"plugins": ["syntax-dynamic-import"]
}
However, it has no effect and there is still an error when trying to build:
error Parsing error: 'import' and 'export' may only appear at the top level
Apparently sage9 uses buble
for bable-like compilation, related issue
From the Bublé docs (emphasis mine):
As the name suggests, Bublé is heavily inspired by (and indebted to) Babel – but there are some key differences:
- Bublé limits itself to ES features that can be compiled to compact, performant ES5 (plus JSX)
- There are no plugins or presets – less extensibility, but also zero configuration
What you are attempting to do does not work because Bublé does not support it, and indeed has specifically stated that not supporting it is by design.
So I have to replace bublé
with full babel compiler?
Are there instructions specicially for sage9?