Commit 525f6da2 authored by shangbj's avatar shangbj

使用ES6语言

parent a96e4348
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="app"></div>
<script src="./dist/bundle.js"></script>
</body>
</html>
\ No newline at end of file
import show from './show';
show("es6")
\ No newline at end of file
This diff is collapsed.
{
"name": "3-1",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"build": "webpack --mode production",
"dev": "webpack --mode development"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"webpack": "^4.12.0",
"webpack-cli": "^3.0.3"
}
}
export default function show(txt){
document.getElementById("app").innerText = `hello${txt}`
}
\ No newline at end of file
const path = require("path");
module.exports = {
entry:'./main.js',
output:{
filename:'bundle.js',
path:path.resolve(__dirname,'./dist'),
},
module:{
rules:[
{
test:/\.js$/,
use:['babel-loader'],
}
]
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment