Skip to content
This repository was archived by the owner on Feb 19, 2022. It is now read-only.
This repository was archived by the owner on Feb 19, 2022. It is now read-only.

Missing loader for example code #80

@TrevorBurnham

Description

@TrevorBurnham

This repo includes a piece of example code, assets/deck.example, and the tutorial provides instructions for including it in the presentation by adding the code

const code = {
  deckSample: require('../assets/deck.example')
};

and the slide

<Slide>
  <ComponentPlayground code={code.deckSample} theme={dark} />
</Slide>

However, doing so yields an error:

ERROR in ./assets/deck.example 1:0
Module parse failed: 'return' outside of function (1:0)
You may need an appropriate loader to handle this file type.
> return (
|   <Deck transition={['zoom','slide']} transitionDuration={800}>
|     <Slide bgColor="primary">
 @ ./presentation/index.js 41:14-47
 @ ./index.js
 @ multi @babel/polyfill webpack-hot-middleware/client react-hot-loader/patch ./index

I was able to get the example code displayed by updating the Webpack config to use the raw loader for .example files:

{
  test: /\.example$/i,
  use: 'raw-loader',
},

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