mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-23 11:55:41 +03:00
Add boilerplate for building with webpack middleware.
This commit is contained in:
parent
a7917cf70e
commit
4bd49a6511
79
generator/src/develop.ts
Normal file
79
generator/src/develop.ts
Normal file
@ -0,0 +1,79 @@
|
||||
// import * as webpack from "webpack";
|
||||
const webpack = require("webpack");
|
||||
const middleware = require("webpack-dev-middleware");
|
||||
const express = require("express");
|
||||
const path = require("path");
|
||||
|
||||
export function start() {
|
||||
const compiler = webpack({
|
||||
// webpack options
|
||||
entry: "index.html",
|
||||
plugins: [],
|
||||
resolve: {
|
||||
modules: [path.join(__dirname, "src"), "node_modules"],
|
||||
extensions: [".js", ".elm", ".scss", ".png"]
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: "babel-loader"
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
exclude: [/elm-stuff/, /node_modules/],
|
||||
// see https://github.com/webpack-contrib/css-loader#url
|
||||
loaders: ["style-loader", "css-loader?url=false", "sass-loader"]
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
exclude: [/elm-stuff/, /node_modules/],
|
||||
loaders: ["style-loader", "css-loader?url=false"]
|
||||
},
|
||||
{
|
||||
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
exclude: [/elm-stuff/, /node_modules/],
|
||||
loader: "url-loader",
|
||||
options: {
|
||||
limit: 10000,
|
||||
mimetype: "application/font-woff"
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
exclude: [/elm-stuff/, /node_modules/],
|
||||
loader: "file-loader"
|
||||
},
|
||||
{
|
||||
test: /\.(jpe?g|png|gif|svg)$/i,
|
||||
exclude: [/elm-stuff/, /node_modules/],
|
||||
loader: "file-loader"
|
||||
},
|
||||
{
|
||||
test: /\.elm$/,
|
||||
exclude: [/elm-stuff/, /node_modules/],
|
||||
use: [
|
||||
{ loader: "elm-hot-webpack-loader" },
|
||||
{
|
||||
loader: "elm-webpack-loader",
|
||||
options: {
|
||||
// add Elm's debug overlay to output?
|
||||
debug: false,
|
||||
forceWatch: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
const app = express();
|
||||
|
||||
app.use(middleware(compiler, { publicPath: "/" }));
|
||||
// webpack-dev-middleware options
|
||||
|
||||
app.listen(3000, () => console.log("Example listening on port 3000!"));
|
||||
}
|
1296
package-lock.json
generated
1296
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -13,14 +13,20 @@
|
||||
"favicons": "^5.4.1",
|
||||
"glob": "^7.1.4",
|
||||
"gray-matter": "^4.0.2",
|
||||
"webpack": "^4.39.2",
|
||||
"webpack-dev-middleware": "^3.7.0",
|
||||
"workbox-build": "^4.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chokidar": "^2.1.3",
|
||||
"@types/express": "^4.17.0",
|
||||
"@types/glob": "^7.1.1",
|
||||
"@types/node": "^12.6.8",
|
||||
"@types/webpack": "^4.32.1",
|
||||
"@types/webpack-dev-middleware": "^2.0.3",
|
||||
"elm": "^0.19.0-no-deps",
|
||||
"elm-test": "^0.19.0-rev6",
|
||||
"express": "^4.17.1",
|
||||
"node-elm-compiler": "^5.0.3",
|
||||
"parcel-bundler": "^1.12.3",
|
||||
"typescript": "^3.5.3"
|
||||
|
Loading…
Reference in New Issue
Block a user