[ [email protected]] use dataToEsm from pluginutils
- Rollup Plugin Name: plugin-yaml
- Rollup Plugin Version: 4.0.1
Expected Behavior / Situation
yaml
---
'1': a
'01': b
'001': c
'0001': d
convert to javascript
{
'1': 'a',
'01': 'b',
'001': 'c',
'0001': 'd'
}
example: http://nodeca.github.io/js-yaml/#yaml=LS0tCicxJzogYQonMDEnOiBiCicwMDEnOiBjCicwMDAxJzogZAo=
Actual Behavior / Situation
yaml
---
'1': a
'01': b
'001': c
'0001': d
convert to javascript
[!] RollupError: Invalid number (Note that you need plugins to import files that are not JavaScript)
Modification Proposal
use dataToEsm
import YAML from 'js-yaml';
// remove toSource
// import toSource from 'tosource';
// use dataToEsm
import { createFilter, makeLegalIdentifier, dataToEsm } from '@rollup/pluginutils';
let code = dataToEsm(data, {
preferConst: false,
compact: false,
namedExports: true,
indent: ' '
});
Why should we do this?
I rewrite question. map key is string . tosource and dataToEsm has different result. yaml example http://nodeca.github.io/js-yaml/#yaml=LS0tCicxJzogYQonMDEnOiBiCicwMDEnOiBjCicwMDAxJzogZAo=
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ