prismicio / slice-machine

A series of tools for developing and deploying website sections with Prismic
https://prismic.io/docs
Apache License 2.0
287 stars 53 forks source link

Slice Machine setup fails to edit nuxt.config.js when it exports a CommonJS module #23

Closed lihbr closed 2 years ago

lihbr commented 4 years ago

Version

Reproduction

  1. npx create-nuxt-app (default preset is fine)
  2. edit nuxt.config.js to have it export a CommonJS module instead of an ES6 one: export default {} > module.exports = {}
  3. prismic sm --setup

What is expected?

Slice Machine setup should at least warn user & hint them to this part of the doc if it detects a CommonJS export. At best it also handles editing config if it's a CommonJS export?

What is actually happening?

Slice Machine fails to edit the config (no modules get registered) and apply a weird formatting.

Any additional information

No clue on that one~ Not sure though if CommonJS exports are allowed there, they work well with Nuxt though 🤔 perhaps it's a non-issue and I've been wrong this whole time ^^'

Not handled by https://github.com/prismicio/babel-transform-config basically.

lihbr commented 3 years ago

Update 02/17/2021:

  1. Not the usual way of exporting a Nuxt config but still a bug
MarcMcIntosh commented 2 years ago

@lihbr is this still an issue?

lihbr commented 2 years ago

I guess, not sure it's necessary to support it though, Nuxt config should be mjs

lihbr commented 2 years ago

We're not updating the Nuxt config anymore, closing now 🎉