parent
236fcd7179
commit
d28180295d
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"@babel/plugin-transform-react-jsx",
|
||||||
|
{
|
||||||
|
"pragma": "justact.createElement"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@babel/plugin-transform-modules-umd"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"comments": false
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
import * as justact from '../src/Example.js';
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
document.write((new justact.Example()).testMethod());
|
||||||
|
|
||||||
|
console.log('jsx test', (
|
||||||
|
<div id='test-div'>
|
||||||
|
<input />
|
||||||
|
</div>
|
||||||
|
));
|
||||||
|
});
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||||
|
<title>jsx WITHOUT react</title>
|
||||||
|
<style>
|
||||||
|
BODY {
|
||||||
|
background-color: #222;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "001-notreact",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"start": "webpack serve --open",
|
||||||
|
"build-babel": "babel src -d dist/src && babel demo -d dist/demo",
|
||||||
|
"build-webpack": "webpack --config webpack.config.js",
|
||||||
|
"build": "npm run build-babel && npm run build-webpack"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/cli": "^7.20.7",
|
||||||
|
"@babel/core": "^7.20.12",
|
||||||
|
"@babel/plugin-transform-modules-umd": "^7.18.6",
|
||||||
|
"@babel/plugin-transform-react-jsx": "^7.20.13"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"html-webpack-plugin": "^5.5.0",
|
||||||
|
"webpack": "^5.75.0",
|
||||||
|
"webpack-cli": "^5.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
export function createElement(tag, attributes, ...children) {
|
||||||
|
return {
|
||||||
|
nodeName: tag,
|
||||||
|
attributes,
|
||||||
|
children
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Example {
|
||||||
|
testMethod () {
|
||||||
|
return 'This is a test for the build configuration';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: "./dist/demo/index.js",
|
||||||
|
mode: "development",
|
||||||
|
output: {
|
||||||
|
path: `${__dirname}/build`,
|
||||||
|
filename: "bundle.js",
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
template: "index.html",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
||||||
Loading…
Reference in new issue