Skip to content

Instantly share code, notes, and snippets.

@Kingdutch
Created April 6, 2020 19:29
Show Gist options
  • Select an option

  • Save Kingdutch/0f32c235cc27d0e22d97408e9db04bc6 to your computer and use it in GitHub Desktop.

Select an option

Save Kingdutch/0f32c235cc27d0e22d97408e9db04bc6 to your computer and use it in GitHub Desktop.
Most simple BSB + Webpack config possible
{
"name": "@open-social/components",
"reason": {
"react-jsx": 3
},
"bsc-flags": ["-bs-super-errors"],
"sources": [
{
"dir": "src",
"subdirs": true
}
],
"package-specs": [
{
"module": "es6",
"in-source": true
}
],
"suffix": ".bs.js",
"namespace": false,
"bs-dependencies": [
"reason-react"
],
"ppx-flags": [],
"refmt": 3
}
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/Index.bs.js',
plugins: [
new HtmlWebpackPlugin({
title: 'Open Social - ReasonML',
}),
],
};
@Kingdutch
Copy link
Author

Namespace is false because I'm following https://dev.to/yawaramin/a-modular-ocaml-project-structure-1ikd to manually organise namespaces.

The idea is that BSB outputs ES6. Then Webpack just treats it like a normal JavaScript project.

Babel is not added yet but this could be done for polyfills and compiling down to ES5 for browsers that need it.

It looks like for now Webpack will always add its own loader stuff: webpack/webpack#2933

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment