slice-machine icon indicating copy to clipboard operation
slice-machine copied to clipboard

fix: allow for slashes in libPath

Open Bram-Zijp opened this issue 3 years ago • 1 comments

I didn't like having linted JS/TS outside of my src folder. Therefor I'm using the following config inside of sm.json:

{
  "apiEndpoint": "https://***.cdn.prismic.io/api/v2",
  "libraries": [
    "@/src/slices"
  ],
  "_latest": "0.0.45",
}

This made the import path incorrect inside of sm-resolver.js e.g.:

import { Fragment } from 'react'
import * as Src/Slices from './src/slices'

const __allSlices = {  ...Src/Slices, }
...

This MR changes the above to:

import { Fragment } from 'react'
import * as SrcSlices from './src/slices'

const __allSlices = {  ...SrcSlices, }
...

Types of changes

  • [x] Bug fix (a non-breaking change which fixes an issue)
  • [ ] New feature (a non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Description

Not sure if this is breaking anywhere else, otherwise, enough should be mentioned. Perhaps it's an idea to fix this in the pascalize function.

Edit: 2 commits, pick your poison :smile:

Bram-Zijp avatar Apr 25 '21 13:04 Bram-Zijp

Hey again @Bram-Zijp, thank you so much for taking the time to open a PR! We'll have a look at it soon~

cc @arnaudlewis, @hypervillain

lihbr avatar Apr 26 '21 16:04 lihbr