css-doodle / css-doodle

🎨 A web component for drawing patterns with CSS.
https://css-doodle.com
MIT License
5.57k stars 209 forks source link

[v0.32.1] Error when using with React/Webpack; Module parse failed: Unexpected token #110

Closed coderfin closed 1 year ago

coderfin commented 1 year ago

In v0.32.1 I get the following error in my React project:

./node_modules/css-doodle/css-doodle.js 6385:50
Module parse failed: Unexpected token (6385:50)
File was processed with these loaders:
 * ./node_modules/@fs/webpack-wci18n/index.js
 * ./node_modules/@fs/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|     let child = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
|     let id = cell_id(x, y, z);
>     return `<cell id="${id}">${content['#' + id] ?? ''}${child ?? ''}</cell>`;
|   }
|   function create_grid(grid_obj, content) {
import React from 'react'
import 'css-doodle'

export default ({ rule = '' }) => <css-doodle>{rule}</css-doodle>

I do not get this error in v0.32.0.

yuanchuan commented 1 year ago

It seems your babel does not support ??. I'll try to update the code next version