4

I want to use es6 import and export featues with grunt setup, but i don't want to use webpack to use import and export,

so Is there any way to use es6 import and export with grunt without using webpack ???

My grunt-babel definition is:

babel: {
options: {
    sourceMap: true,
    presets: ['es2015']
},
build: {
    files: [{
        expand: true, // Enable dynamic expansion
        cwd: 'src/jass',
        src: ['**/*.js'], // Actual patterns to match
        dest: 'src/j'
    }]
}
}

I have uploaded the problem statement on Github, kindly refer it

So when i run index.html, got the error "define is not defined" enter image description here

coder
  • 1,874
  • 2
  • 22
  • 31

1 Answers1

0

You might want to read about babel-cli which can do what you want, or if your primary focus is to get import and export working, you can use babel-node.

Consider reading this: https://babeljs.io/docs/usage/cli/

Leo Napoleon
  • 969
  • 6
  • 11
  • Yes my primary focus is how to use import and export using grunt setup. bcz after complie my code using babel and run the same code in browser, it throws an error. "import or export is not defined". so have i missed out any loader plugin, which i have to specify in grunt config. – coder May 26 '16 at 09:25