systemjs / plugin-babel

SystemJS Babel Plugin
MIT License
82 stars 33 forks source link

react preset is not working #67

Open kesavkolla opened 8 years ago

kesavkolla commented 8 years ago

I've the following config

    SystemJS.config({
        defaultJSExtensions: true,
        meta: {
            '*.jsx': {
                'loader': 'plugin-babel',
                'format': 'cjs',
                'babelOptions': {
                    'modularRuntime': false,
                    stage1: true,
                    presets: ['babel-preset-react']
                }
            }
        },
        map: {
            'plugin-babel': 'unpkg:systemjs-plugin-babel@latest/plugin-babel.js',
            'systemjs-babel-build': 'unpkg:systemjs-plugin-babel@latest/systemjs-babel-browser.js',
            'babel-preset-react': 'npm:babel-preset-react',
            'react': 'unpkg:react@15.3.2/dist/react.min.js',
            'react-dom': 'unpkg:react-dom@15.3.2/dist/react-dom.min.js',
            'react-bootstrap': 'unpkg:react-bootstrap@0.30.5/dist/react-bootstrap.min.js'
        },
        transpiler: 'plugin-babel',
        paths: {
            '*': 'https://registry.jspm.io/*.js',
            'npm:*': 'https://npm.jspm.io/*.js',
            'github:*': 'https://github.jspm.io/*.js',
            'unpkg:*': 'https://unpkg.com/*',
        },
        packages: {
            'unpkg:*': {
                defaultExtension: false
            },
            './': {
                defaultExtension: false
            }
        }
    });
    SystemJS.import('./app.jsx').then(function (m) {
        console.log(m);
    });

image

aufula commented 7 years ago

@kesavkolla same issue. finally, figure out by myself. try this config

    SystemJS.config({
        baseURL:'https://unpkg.com/',
        defaultExtension: true,
        meta: {
            '*.jsx': {
                'babelOptions': {
                    react: true
                }
            }
        },
        map: {
            'plugin-babel': 'systemjs-plugin-babel@latest/plugin-babel.js',
            'systemjs-babel-build': 'systemjs-plugin-babel@latest/systemjs-babel-browser.js',
            'react': 'react@15.3.2/dist/react.min.js',
            'react-dom': 'react-dom@15.3.2/dist/react-dom.min.js'
        },
        transpiler: 'plugin-babel'
    });

    SystemJS.import('./comp-a.jsx').then(function (m) {
        console.log(m);
    });