json Webpack和Babel配置(Andrew Mead)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json Webpack和Babel配置(Andrew Mead)相关的知识,希望对你有一定的参考价值。
const path = require('path')
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'public/scripts'),
filename: 'bundle.js'
},
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}]
},
devServer: {
contentBase: path.resolve(__dirname, 'public'),
publicPath: '/scripts/'
},
devtool: 'source-map'
}
{
"name": "boilerplate",
"version": "1.0.0",
"description": "",
"main": "input.js",
"scripts": {
"dev-server": "webpack-dev-server --mode development",
"build": "webpack --mode production"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"live-server": "^1.2.0",
"webpack": "^4.5.0",
"webpack-cli": "^2.0.14",
"webpack-dev-server": "^3.1.3"
}
}
以上是关于json Webpack和Babel配置(Andrew Mead)的主要内容,如果未能解决你的问题,请参考以下文章
配置 webpack babel-loader 与在 package.json 中配置有啥区别?
VScode:ES6 & Nodejs & webpack & babel
json Webpack 4 config.js(SCSS到CSS和Babel)
webpack生产环境的基本配置 - 提取CSS文件 - CSS/JS兼容性处理 - babel - ESLint - HTML/CSS/JS压缩
基于webpack.config.js和babel.config.js及package.json构建项目的demo
React开发环境搭建(react,babel,webpack webpack-dev-server)