Better webpack config
This commit is contained in:
parent
957ac0f133
commit
f0b01f1974
5
package-lock.json
generated
5
package-lock.json
generated
@ -283,6 +283,11 @@
|
||||
"integrity": "sha512-HyYEUDeIj5rRQU2Hk5HTB2uHsbRQpF70nvMhVzi+VJR0X+xNEhjPui4/kBf3VeH/wqD28PT4sVOm8qqLjBrSZg==",
|
||||
"dev": true
|
||||
},
|
||||
"@hotwired/turbo": {
|
||||
"version": "7.0.0-beta.3",
|
||||
"resolved": "https://registry.npmjs.org/@hotwired/turbo/-/turbo-7.0.0-beta.3.tgz",
|
||||
"integrity": "sha512-lOyxOaZJBLxD8sGowjghkmCxuN4FcqYDciRI88DuzyXok35vK6nYewGSfZ4SOpb7McOJ5qVChEsUaBfmY+N8NA=="
|
||||
},
|
||||
"@koa/router": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@koa/router/-/router-10.0.0.tgz",
|
||||
|
@ -9,6 +9,7 @@
|
||||
"test": "./npm.sh run test-cmd -- ",
|
||||
"build:back": "tsc -p src/back",
|
||||
"build:front": "webpack",
|
||||
"build": "npm run build:back && npm run build:front",
|
||||
"watch:back": "tsc --watch -p src/back",
|
||||
"watch:front": "webpack --watch",
|
||||
"watch": "concurrently npm:watch:back npm:watch:front",
|
||||
@ -19,6 +20,7 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.12.10",
|
||||
"@hotwired/turbo": "^7.0.0-beta.3",
|
||||
"sealious": "^0.13.4",
|
||||
"stimulus": "^2.0.0"
|
||||
},
|
||||
|
@ -27,8 +27,3 @@ body {
|
||||
padding: 0.5rem;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
turbo-frame {
|
||||
border: 1px solid red;
|
||||
display: block;
|
||||
}
|
||||
|
@ -3,9 +3,6 @@ export default function html(body: string): string {
|
||||
<html>
|
||||
<link href="/style.css" rel="stylesheet" type="text/css" />
|
||||
${body}
|
||||
<script type="module">
|
||||
import hotwiredTurbo from "https://cdn.skypack.dev/@hotwired/turbo";
|
||||
</script>
|
||||
<script src="/dist/bundle.js"></script>
|
||||
</html>`;
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { Controller } from "stimulus";
|
||||
|
||||
window;
|
||||
|
||||
export default class extends Controller {
|
||||
export default class TaskController extends Controller {
|
||||
id: string;
|
||||
|
||||
connect() {
|
||||
|
@ -1,6 +0,0 @@
|
||||
import { Application } from "stimulus";
|
||||
import { definitionsFromContext } from "stimulus/webpack-helpers";
|
||||
|
||||
const application = Application.start();
|
||||
const context = require.context("./controllers", true, /\.[jt]s$/);
|
||||
application.load(definitionsFromContext(context));
|
8
src/front/index.ts
Normal file
8
src/front/index.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import * as Turbo from "@hotwired/turbo";
|
||||
import { Application } from "stimulus";
|
||||
import TaskController from "./controllers/task_controller";
|
||||
|
||||
export { Turbo };
|
||||
|
||||
const application = Application.start();
|
||||
application.register("task", TaskController);
|
@ -4,5 +4,5 @@
|
||||
"target": "ES6",
|
||||
"lib": ["dom"]
|
||||
},
|
||||
"include": ["./**/*"]
|
||||
"include": ["./**/*", "./index.ts"]
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ module.exports = [
|
||||
{
|
||||
name: "front-end-components",
|
||||
entry: {
|
||||
bundle: "./src/front/index.js",
|
||||
bundle: "./src/front/index.ts",
|
||||
},
|
||||
|
||||
output: {
|
||||
@ -15,6 +15,10 @@ module.exports = [
|
||||
mode: "production",
|
||||
devtool: "source-map",
|
||||
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"],
|
||||
},
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user