Neutrino not transforming spread operator

时间:2018-05-09 02:48:22

标签: javascript babeljs spread-syntax neutrino

I'm new to Neutrino, but I have my project working for everything but the object spread operator let bar = {...foo, x: 1} yields Module parse failed: Unexpected token over and over. I'm already using the react preset/middleware, but I went ahead and manually added the transform plugin as well when the preset alone didn't work. Here is my .neutrinorc.js config:

module.exports = {
    options: {
        mains: {
            index: 'index',
            login: 'login'
        }
    },
    use: [
        ['@neutrinojs/react', { html: { title: 'SST' }}],
        ['@neutrinojs/dev-server', { port: 1332 }],
        '@neutrinojs/mocha',
        neutrino => {
            // access the Neutrino API    
            neutrino.config.resolve.modules.add('node_modules');

            neutrino.config.module
            .rule('compile')
              .use('babel')
                .tap(options => {
                    options.plugins.push(require.resolve('babel-plugin-transform-object-rest-spread'))
                    return options;
                });
         }
    ]
};

0 个答案:

没有答案