rollup / rollup-plugin-babel

This package has moved and is now available at @rollup/plugin-babel / https://github.com/rollup/plugins/tree/master/packages/babel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simple setup - am i missing sth?

nerdess opened this issue · comments

commented

i am trying to get the plugin to transpile the code inside public/bundle.js from ES6 to ES5 but it has no effect, the code is still ES6.

my rollup.config.js is quite simple:

import svelte from 'rollup-plugin-svelte';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import rollup_start_dev from './rollup_start_dev';
import css from 'rollup-plugin-css-only';
import json from 'rollup-plugin-json';
import autoPreprocess from 'svelte-preprocess';
import babel from 'rollup-plugin-babel';

const production = !process.env.ROLLUP_WATCH;

export default {
	input: 'src/main.js',
	output: {
		sourcemap: true,
		format: 'iife',
		name: 'app',
		file: 'public/bundle.js'
	},
	plugins: [
		svelte({
			dev: !production,
			css: css => {
				css.write('public/bundle.css');
			},
			preprocess: autoPreprocess()
		}),
		json(),
		css({output:'public/libs.css'}),
		resolve({
			browser: true,
			dedupe: importee => importee === 'svelte' || importee.startsWith('svelte/')
		}),
		babel({
			babelrc: false,
			presets: [['@babel/env', { modules: false }]],
			exclude: 'node_modules/**'
		}),		  
		commonjs(),

		!production && rollup_start_dev,

		!production && livereload('public'),

		production && terser(),
		
	],
	watch: {
		clearScreen: false
	}
};
  

am i missing sth? e.g. is a .babelsrc with additional configuration required?

commented

fixed it now using this guide: https://blog.az.sg/posts/svelte-and-ie11/