Commit 2a0a7d35 authored by Master Q's avatar Master Q

项目初始化

parents
{
"presets": [
// ["@babel/preset-env", {
// "targets": "> 0.25%, not dead"
// }],
"@babel/preset-typescript"
],
"plugins": [
// ["@babel/plugin-transform-runtime", {
// // "corejs": 3
// }],
"@babel/plugin-proposal-optional-chaining",
"./babel-plugins/babel-plugins-test.js"
]
}
\ No newline at end of file
# project ignores
node_modules
released
.DS_Store
.idea
output.js
output.js.map
\ No newline at end of file
This diff is collapsed.
<!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, maximum-scale=1.0, user-scalable=0" />
<title>Three</title>
<style>
* {
padding: 0;
margin: 0;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout:none;
-webkit-user-select:none;
-khtml-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
touch-action: none;
}
div {
user-select: none;
}
html,
body {
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background-color: #ffffff;
/* background: linear-gradient(#93dbb7,#ff0,#b5d89a); */
/* background: linear-gradient(#93dbb7,#b5d89a); */
/* 背景图片,解决加载太慢,白屏问题,加了这个下面的__loading__可以删掉了 */
/* background-size: 100%;
background-position: center;
background-image: url("https://yun.duiba.com.cn/db_games/activity/game/1550472986/resource/assets/playscene/playscenebg.jpg"); */
}
</style>
<script src="//yun.duiba.com.cn/db_games/libs0924/fyge2020.min.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="ss" style="line-height:0;font-size:0;position: absolute;">
<canvas id="stage" style="width: 100%;height: 100%"></canvas>
</div>
<!-- 这里的 bundle 就是 webpack 临时打包出来 -->
<script src="output.js"></script>
<script type="module">
window.addEventListener("load", function () {
})
</script>
</body>
</html>
\ No newline at end of file
{
"name": "babeltemplate",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "node ./scripts/devServer.js",
"babelbuild": "babel src --out-dir dist --extensions .ts,.tsx",
"build": "webpack --config webpack.prod.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.19.3",
"@babel/core": "^7.19.3",
"@babel/helper-module-imports": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
"@babel/plugin-syntax-jsx": "^7.18.6",
"@babel/plugin-transform-runtime": "^7.19.1",
"@babel/preset-env": "^7.19.1",
"@babel/preset-typescript": "^7.18.6",
"babel-loader": "^8.2.5",
"ts-loader": "^9.4.1",
"typescript": "^4.8.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1",
"webpack-merge": "^5.8.0"
}
}
const webpackDevServer = require('webpack-dev-server')
const webpack = require('webpack')
const config = require('../webpack.dev.js')
const compiler = webpack(config)
const server = new webpackDevServer(config.devServer, compiler)
const argv = process.argv;
const runServer = async () => {
const ipV4 = await webpackDevServer.internalIP('v4')
console.log('========== ipV4 ==========', ipV4)
server.options.host = ipV4
const argvPort = +argv[argv.indexOf("-p") + 1]
argvPort && (server.options.port = +argv[argv.indexOf("-p") + 1])
await server.start()
}
runServer()
\ No newline at end of file
console.log(123)
\ No newline at end of file
This diff is collapsed.
const path = require('path')
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: {
index: './src/index'
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /(node_modules)/,
use: [
{
loader: 'babel-loader',
}
],
exclude: /node_modules/
}
],
},
resolve: {
alias: {
'@': './src'
},
extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: 'output.js',
path: __dirname, // path.resolve(__dirname, './dist'),
libraryTarget: 'umd'
}
}
\ No newline at end of file
const {merge} = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path')
// const webpack = require('webpack');
// const MockWebpackPlugin = require('mock-webpack-plugin');
// const mockConfig = require('./mock/config.js');
module.exports = merge(common, {
mode: "development",
devtool: 'eval-source-map',
devServer: {
open: true,
hot: true,
host: '0.0.0.0',
static: '.'
}
});
const {merge} = require('webpack-merge');
const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: "development",//production development
devtool: 'source-map',
plugins: [
]
});
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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