Initial commit
This commit is contained in:
commit
929cfe5e73
11
package.json
Normal file
11
package.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "next-haskell",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "Next.js integration for Haskell",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "Obsidian Systems LLC",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
}
|
31
src/index.js
Normal file
31
src/index.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
module.exports = (nextConfig = {}) => {
|
||||||
|
return Object.assign({}, nextConfig, {
|
||||||
|
webpack(config, options) {
|
||||||
|
if (!options.defaultLoaders) {
|
||||||
|
throw new Error(
|
||||||
|
'This plugin is not compatible with Next.js versions below 5.0.0 https://err.sh/next-plugins/upgrade'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { dir, defaultLoaders, dev, isServer } = options;
|
||||||
|
|
||||||
|
config.module.rules.push({
|
||||||
|
test: /\.(cabal)$/,
|
||||||
|
include: [dir],
|
||||||
|
exclude: /dist-newstyle/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'haskell-loader',
|
||||||
|
options: { dev: false, isServer },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (typeof nextConfig.webpack === 'function') {
|
||||||
|
return nextConfig.webpack(config, options)
|
||||||
|
} else {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user