Created
March 15, 2018 07:24
-
-
Save IrenaYuan/22bb40809696ce96cadd6ac71c19c7c9 to your computer and use it in GitHub Desktop.
Note for webpack3 with babel, react...setting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
//... | |
module: { | |
/* version 1 | |
* use loaders | |
*/ | |
loaders:[ | |
{ | |
test: /\.js[x]?$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader?presets[]=es2015&presets[]=react', | |
}, | |
], | |
/* version 2 | |
* loaders > rules | |
*/ | |
rules: [{ | |
test: /\.js[x]?$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader?presets[]=es2015&presets[]=react' | |
}], | |
/* version 3 | |
* following webpack docs `babel-loader` | |
* note: options > presents 一般都是寫在.babelrc內 | |
* 但這樣寫可以動 | |
*/ | |
rules: [{ | |
test: /\.js[x]?$/, | |
exclude: /node_modules/, | |
use: { | |
loader: 'babel-loader', | |
options: { | |
presets: ['es2015', 'react'] | |
} | |
} | |
}] | |
} | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment