npm init -y
install module du packages.json
webpack.config.js
babel.config.json
create src folder // index.html // index.js
dans le package json créer "webpak" : "serve" :
Last active
October 4, 2021 15:18
-
-
Save olygood/9d0f845a2cfe4fa94eee36e7fbb93861 to your computer and use it in GitHub Desktop.
Project Snake Babel, Webpack
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
{ | |
"presets": ["@babel/preset-env"] | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<h1>hello les mecs</h1> | |
<script type="module" src="index.js"></script> | |
</body> | |
</html> |
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
{ | |
"name": "snakenewstructure", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"webpack": "webpack", | |
"serve": "webpack server --mode development" | |
}, | |
"author": "olygood", | |
"license": "ISC", | |
"dependencies": { | |
"babel-loader": "^8.2.2", | |
"html-webpack-plugin": "^5.3.2", | |
"webpack": "^5.56.1", | |
"webpack-cli": "^4.8.0" | |
}, | |
"devDependencies": { | |
"@babel/cli": "^7.15.7", | |
"@babel/core": "^7.15.5", | |
"@babel/preset-env": "^7.15.6", | |
"webpack-dev-server": "^4.3.0" | |
} | |
} |
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"); | |
const HtmlWebpackPlugin = require("html-webpack-plugin"); | |
module.exports = { | |
entry: path.resolve(__dirname, "src/index.js"), | |
output: { | |
path: path.resolve(__dirname, "dist"), | |
filename: "[name].bundle.js" | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: { | |
loader: "babel-loader" | |
} | |
} | |
] | |
}, | |
plugins: [ | |
new HtmlWebpackPlugin({ | |
template: path.resolve(__dirname, "src/index.html") | |
}) | |
], | |
devtool: "source-map", | |
mode: "development", | |
devServer:{ | |
port: 3010, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment