FormidableLabs / spectacle-boilerplate

[DEPRECATED] Boilerplate project for getting started with Spectacle Core
579 stars 192 forks source link

Missing loader for example code #80

Open TrevorBurnham opened 5 years ago

TrevorBurnham commented 5 years ago

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',
},
leonidlebedev commented 5 years ago

Same problem