Skip to content

"Uncaught Error: Element type is invalid" if .scss file with same base name exists in importing file's folder #299

@dakinshin

Description

@dakinshin

I believe it is a bug, but not sure if I'm reporting in right place, may be it is related to meteor itself.

Fourseven plugin breaks TSX import (and probably jsx too) if scss file with same base name exists in importing file's directory

Folder structure:

/client/
-main.tsx
/imports/
-ui/
--App.tsx
--App.scss

main.tsx:

import { App } from '../imports/ui/App'

console.log(App)

Meteor.startup(() => {
  render(<App />, document.getElementById('react-target'))
})

App.tsx:

import React from 'react'

export const App = () => (
  <div className="App">We are the champions !!!</div>
)

Expected behavior: App.tsx imported into main.tsx

Actual behavior: App is undefined in main.tsx, error thrown in console:

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for 
composite components) but got: undefined. You likely forgot to export your component from the file it's defined 
in, or you might have mixed up default and named imports.
    at createFiberFromTypeAndProps (modules.js?hash=4bd233f962055aadccb0f50497afa216771d6d60:28938)
    at createFiberFromElement (modules.js?hash=4bd233f962055aadccb0f50497afa216771d6d60:28966)
    at reconcileSingleElement (modules.js?hash=4bd233f962055aadccb0f50497afa216771d6d60:17932)
    at reconcileChildFibers (modules.js?hash=4bd233f962055aadccb0f50497afa216771d6d60:17992)
    at reconcileChildren (modules.js?hash=4bd233f962055aadccb0f50497afa216771d6d60:20877)
    at updateHostRoot (modules.js?hash=4bd233f962055aadccb0f50497afa216771d6d60:21479)
    at beginWork (modules.js?hash=4bd233f962055aadccb0f50497afa216771d6d60:22957)
    at HTMLUnknownElement.callCallback (modules.js?hash=4bd233f962055aadccb0f50497afa216771d6d60:7825)
    at Object.invokeGuardedCallbackDev (modules.js?hash=4bd233f962055aadccb0f50497afa216771d6d60:7874)
    at invokeGuardedCallback (modules.js?hash=4bd233f962055aadccb0f50497afa216771d6d60:7936)

But, if App.scss is renamed to styles.scss, or if fourseven package is removed, import is working as expected
I think it is at least unexpected behaviour or probably bug.

Meteor 1.12
fourseven:scss 4.12.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions