Better webpack config

master
Kuba Orlik 4 years ago
parent 957ac0f133
commit f0b01f1974

5
package-lock.json generated

@ -283,6 +283,11 @@
"integrity": "sha512-HyYEUDeIj5rRQU2Hk5HTB2uHsbRQpF70nvMhVzi+VJR0X+xNEhjPui4/kBf3VeH/wqD28PT4sVOm8qqLjBrSZg==", "integrity": "sha512-HyYEUDeIj5rRQU2Hk5HTB2uHsbRQpF70nvMhVzi+VJR0X+xNEhjPui4/kBf3VeH/wqD28PT4sVOm8qqLjBrSZg==",
"dev": true "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": { "@koa/router": {
"version": "10.0.0", "version": "10.0.0",
"resolved": "https://registry.npmjs.org/@koa/router/-/router-10.0.0.tgz", "resolved": "https://registry.npmjs.org/@koa/router/-/router-10.0.0.tgz",

@ -9,6 +9,7 @@
"test": "./npm.sh run test-cmd -- ", "test": "./npm.sh run test-cmd -- ",
"build:back": "tsc -p src/back", "build:back": "tsc -p src/back",
"build:front": "webpack", "build:front": "webpack",
"build": "npm run build:back && npm run build:front",
"watch:back": "tsc --watch -p src/back", "watch:back": "tsc --watch -p src/back",
"watch:front": "webpack --watch", "watch:front": "webpack --watch",
"watch": "concurrently npm:watch:back npm:watch:front", "watch": "concurrently npm:watch:back npm:watch:front",
@ -19,6 +20,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@babel/core": "^7.12.10", "@babel/core": "^7.12.10",
"@hotwired/turbo": "^7.0.0-beta.3",
"sealious": "^0.13.4", "sealious": "^0.13.4",
"stimulus": "^2.0.0" "stimulus": "^2.0.0"
}, },

@ -27,8 +27,3 @@ body {
padding: 0.5rem; padding: 0.5rem;
margin-left: 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> <html>
<link href="/style.css" rel="stylesheet" type="text/css" /> <link href="/style.css" rel="stylesheet" type="text/css" />
${body} ${body}
<script type="module">
import hotwiredTurbo from "https://cdn.skypack.dev/@hotwired/turbo";
</script>
<script src="/dist/bundle.js"></script> <script src="/dist/bundle.js"></script>
</html>`; </html>`;
} }

@ -1,8 +1,6 @@
import { Controller } from "stimulus"; import { Controller } from "stimulus";
window; export default class TaskController extends Controller {
export default class extends Controller {
id: string; id: string;
connect() { 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));

@ -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", "target": "ES6",
"lib": ["dom"] "lib": ["dom"]
}, },
"include": ["./**/*"] "include": ["./**/*", "./index.ts"]
} }

@ -4,7 +4,7 @@ module.exports = [
{ {
name: "front-end-components", name: "front-end-components",
entry: { entry: {
bundle: "./src/front/index.js", bundle: "./src/front/index.ts",
}, },
output: { output: {
@ -15,6 +15,10 @@ module.exports = [
mode: "production", mode: "production",
devtool: "source-map", devtool: "source-map",
resolve: {
extensions: [".ts", ".js"],
},
module: { module: {
rules: [ rules: [
{ {

Loading…
Cancel
Save