dante2
dante2 copied to clipboard
Transpiled isomorphic bundle (for server-side rendering)
Hi!
I use next.js in my project and try to connect dante.
When I import it as react component: import { Dante, DanteEditor } from 'Dante2/es';
Webpack throws such error:
../node_modules/Dante2/es/index.js:1
(function (exports, require, module, __filename, __dirname) { import { DanteEditor, Dante } from './components/init.js';
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:588:28)
at Module._compile (/Users/Drapegnik/projects/babajka/frontend/node_modules/source-map-support/source-map-support.js:483:25)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
Under the hood next.js used webpack@3+
This this my babel config:
"presets": [
"next/babel",
"stage-0"
],
Do you have any ideas what's wrong?
Thanks.
I found, that next.js ignore the node_modules directory from being compiled by babel.
Is there any possibility to import transpiled version of Dante component?
Since next.js does the server-side rendering I get ReferenceError: window is not defined when importing Dante. (as well as in #40 I need ssr articles for seo optimization)
So is it possible to build isomorphic transpiled bundle of Dante without references to window?