Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use .babelrc for markdown generated examples #853

Closed
yang-jandro opened this issue Mar 3, 2018 · 2 comments
Closed

Use .babelrc for markdown generated examples #853

yang-jandro opened this issue Mar 3, 2018 · 2 comments
Labels

Comments

@yang-jandro
Copy link

yang-jandro commented Mar 3, 2018

Is it possible to use a projects .bablerc for parsing a markdown example and on live edit? New to styleguidist and everything else seems to be working as excepted.

styleguide.config.js

module.exports = {
    components: './src/components/**/*.{js,jsx}',
    webpackConfig: require('./webpack.config.js'),
    template: './.styleguide/template.html'
};

package.json

{
  "scripts": {
    "styleguide": "styleguidist server"
  },
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "css-loader": "^0.28.7",
    "less": "^2.7.3",
    "less-loader": "^4.0.5",
    "style-loader": "^0.19.1",
    "webpack": "^3.10.0",
    "webpack-merge": "^4.1.1"
  },
  "dependencies": {
    "babel-polyfill": "^6.26.0",
    "query-string": "^5.0.1",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-highcharts": "^16.0.2",
    "react-router-dom": "^4.2.2",
    "react-scroll-to-component": "^1.0.2"
  }
}

webpack.config.js

const path = require('path');
const APP_DIR = path.resolve(__dirname, 'src');

module.exports = {
    module: {
        loaders: [
            {
                test: /\.(js|jsx)$/,
                include: APP_DIR,
                loader: 'babel-loader'
            },
            {
                test: /\.less$/,
                use: [
                    'style-loader',
                    {
                        loader: 'css-loader',
                        options: {
                            importLoaders: 1,
                            modules: true,
                            localIdentName: '[name]__[local]__[hash:base64:5]'
                        }
                    },
                    'less-loader'
                ]
            }
        ]
    },
    resolve: {
        extensions: ['.js', '.jsx'],
        modules: [ path.resolve(__dirname, 'src'), 'node_modules' ]
    }
}

.bablerc

{
    "presets": [
        "env",
        "react"
    ],
    "plugins": [
        "transform-class-properties",
        "transform-object-rest-spread"
    ]
}

Error

screen shot 2018-03-02 at 6 28 34 pm

@sapegin
Copy link
Member

sapegin commented Mar 5, 2018

@yang-jandro
Copy link
Author

yang-jandro commented Mar 5, 2018

@sapegin I see now. Must have miss read Buble for Babel. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants