Skip to content
Snippets Groups Projects
Commit 95910df7 authored by Victor Mougel's avatar Victor Mougel
Browse files

correction

parent 4d7b19ba
Branches master
No related tags found
No related merge requests found
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/
/******/
/******/ })()
;
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<link rel="stylesheet" href="css/news.css"> <link rel="stylesheet" href="css/news.css">
<link rel="stylesheet" href="css/pizzaList.css"> <link rel="stylesheet" href="css/pizzaList.css">
<link rel="stylesheet" href="css/footer.css"> <link rel="stylesheet" href="css/footer.css">
<script type="module" src="build/main.js"></script> <script src="build/main.bundle.js" defer></script>
</head> </head>
<body> <body>
<header> <header>
......
This diff is collapsed.
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
"name": "pizzaland", "name": "pizzaland",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "main.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "babel src -d build", "build": "webpack --mode=production",
"auto": "babel src -d build --verbose --watch --source-maps" "watch": "webpack --mode=development --watch"
}, },
"author": "Thomas Fritsch <thomas.fritsch@univ-lille.fr> (https://gitlab.univ-lille.fr/thomas.fritsch)", "author": "Thomas Fritsch <thomas.fritsch@univ-lille.fr> (https://gitlab.univ-lille.fr/thomas.fritsch)",
"homepage": "https://gitlab.univ-lille.fr/js", "homepage": "https://gitlab.univ-lille.fr/js",
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
"@babel/cli": "^7.16.8", "@babel/cli": "^7.16.8",
"@babel/core": "^7.16.12", "@babel/core": "^7.16.12",
"@babel/preset-env": "^7.16.11", "@babel/preset-env": "^7.16.11",
"prettier": "^2.5.1" "babel-loader": "^8.2.3",
"prettier": "^2.5.1",
"webpack": "^5.68.0",
"webpack-cli": "^4.9.2"
} }
} }
export class Component { export class Component {
tagName; tagName;
children; children;
attribute;
constructor(tagName, attribute, children) { constructor(tagName, attribute, children) {
this.tagName = tagName; this.tagName = tagName;
......
export class Img { import { Component } from "./Component.js";
src;
constructor(src) {
this.src = src;
}
render() { export class Img extends Component {
return `<img src=${this.src}/>`; constructor(src) {
super("img", { name: "src", value: src }, null);
} }
} }
const path = require("path");
module.exports = {
// Fichier d'entrée :
entry: "./src/main.js",
// Fichier de sortie :
output: {
path: path.resolve(__dirname, "./build"),
filename: "main.bundle.js",
},
// compatibilité anciens navigateurs (si besoin du support de IE11 ou android 4.4)
target: ["web", "es5"],
// connexion webpack <-> babel :
module: {
rules: [
{
test: /\.js$/, // tous les fichiers js ...
exclude: /node_modules/, // ... sauf le dossier node_modules ...
use: {
// ... seront compilés par babel !
loader: "babel-loader",
},
},
],
},
devtool: "cheap-source-map",
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment