Last active
May 20, 2020 10:30
-
-
Save vsashyn/e81dd6f62f5cb7904fad220d2f108506 to your computer and use it in GitHub Desktop.
Configure webpack + babel simple project. Watch mode + source maps.
This file contains hidden or 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 = function (api) { | |
api.cache(true); | |
const presets = [ "@babel/preset-env" ]; | |
return { | |
presets, | |
}; | |
} |
This file contains hidden or 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
// CLI | |
// 1. yarn init | |
// 2. yarn add @babel/core @babel/preset-env babel-loader webpack webpack-cli webpack-dev-server --dev | |
// 3. Add webpack.config.js | |
// 4. Add babel.config.js | |
// 5. Add script '"watch": "webpack-dev-server" | |
// Enjoy <3 |
This file contains hidden or 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
const path = require('path'); | |
module.exports = { | |
mode: "development", | |
entry: './src/index.js', | |
devtool: 'inline-source-map', | |
module: { | |
rules: [ | |
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" } | |
], | |
}, | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist'), | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment