Commit 3ac42c25 authored by James Laver's avatar James Laver

Merge branch 'update-webpack-tooling' into 'dev'

simplify webpack setup

See merge request !24
parents d05bc38b 5fb755d4
......@@ -4,6 +4,7 @@
"rebuild-set": "spago psc-package-insdhall",
"install-ps": "psc-package install",
"compile": "pulp --psc-package build",
"prebuild": "yarn compile",
"build": "pulp --psc-package browserify -t dist/bundle.js",
"sass": "sass dist/styles/",
"predev": "yarn prestart",
......
function _push(a, i) { a.push(i); }
module.exports={
_push: _push
};
function _push(a, i) {
a.push(i);
}
exports._push = _push;
function _cloneRegex(r) { return new RegExp(r.source, r.flags); }
function _getRegexLastIndex(r) { return r.lastIndex; }
function _execRegex(r, s) { return r.exec(s); }
module.exports={
_cloneRegex: _cloneRegex,
_getRegexLastIndex: _getRegexLastIndex,
_execRegex: _execRegex
};
function _cloneRegex(r) {
return new RegExp(r.source, r.flags);
}
function _getRegexLastIndex(r) {
return r.lastIndex;
}
function _execRegex(r, s) {
return r.exec(s);
}
exports._cloneRegex = _cloneRegex;
exports._getRegexLastIndex = _getRegexLastIndex;
exports._execRegex = _execRegex;
// This file is just a wrapper so that webpack will call our main function
require('./Main.purs').main();
require('../output/Main').main();
......@@ -8,33 +8,11 @@ let HtmlWebpackPlugin = require('html-webpack-plugin');
let CleanWebpackPlugin = require('clean-webpack-plugin');
let isWatch = process.argv.some(a => a === '--watch');
// TODO: We have agreed to move to spago, but not done it yet
// let spago_sources = async () =>
// exec.quiet(
// "psc-package sources",
// { options: 'strict' }
// ).then(function (res) {
// let sources = res.stdout.split(/\r?\n/);
// sources.pop(); // extra newline at the end of output
// return sources;
// });
let dist = path.join(__dirname, 'dist');
let src = path.join(__dirname, 'src');
let test = path.join(__dirname, 'test');
// kill when spago
let futured = async () => new Promise((resolve, _) => resolve([]));
module.exports = (env) =>
// spago_sources()
futured()
.then(function (ps_sources) {
ps_sources.push('src/**/*.purs');
// TODO: testing in browser and headless
// if (env === "browser" || env === "headless")
// ps_sources.push('test/Main.purs');
module.exports = (env) =>{
let config = {
cache: true,
mode: 'development',
......@@ -52,22 +30,6 @@ module.exports = (env) =>
},
module: {
rules: [
{test: /\.purs$/,
exclude: /(node_modules)/,
use: [
{loader: "purs-loader",
options: {
src: ps_sources,
output: dist,
pscIde: true,
pscIdeClientArgs: {port: 4002},
pscIdeServerArgs: {port: 4002},
pscArgs: {codegen: "js,sourcemaps"},
pscPackage: true,
bundle: false,
watch: isWatch}},
{loader: "source-map-loader"},
]},
{test: /\.css$/,
exclude: /(node_modules)/,
use: ["style-loader", "css-loader"]},
......@@ -75,13 +37,13 @@ module.exports = (env) =>
exclude: /(node_modules)/,
use: [ "file-loader" ]},
{test: /\.js$/,
exclude: /(node_modules)/,
exclude: [/(node_modules)/, /(output)/],
use: ["babel-loader", "source-map-loader"]}
]
},
resolve: {
modules: [ 'node_modules' ],
extensions: [ '.purs', '.js']
extensions: [ '.js']
},
plugins: [
// TODO: can we put the checked-in assets in dist somewhere else
......@@ -110,4 +72,4 @@ module.exports = (env) =>
console.log("unknown env: ", env);
}
return config;
});
};
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