Specify in-source: false?
tom-sherman opened this issue · 3 comments
tom-sherman commented
in-source: false allows Rescript files to be built to an external directory, instead of the build artefacts existing next to the source files.
Is this possible? I tried to specify it and tweak the mount options but I couldn't get it to work.
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
public: { url: '/', static: true },
'lib/es6/src': { url: '/dist' },
src: { url: '/dist' },
},
plugins: [
'@snowpack/plugin-react-refresh',
'@snowpack/plugin-dotenv',
[
'@snowpack/plugin-run-script',
{
cmd: 'bsb -make-world',
watch: '$1 -w',
},
],
],
packageOptions: {
/* ... */
},
devOptions: {
/* ... */
},
buildOptions: {
/* ... */
},
alias: {
/* ... */
},
};
jihchi commented
Yes, It seems like we couldn't assign two directories to serve /dist
endpoint.
Also, I tried to add an new endpoint (/res
) to serve lib/es6/src
folder, unfortunately it does not works:
- Add an new endpoint
/res
which content is coming fromlib/es6/src
:
// snowpack.config.js
mount: {
public: { url: "/", static: true },
"lib/es6/src": { url: "/res" },
src: { url: "/dist" },
},
- Change the endpoint of entry file in
public/index.html
:
// public/index.html
- <script type="module" src="/dist/index.bs.js"></script>
+ <script type="module" src="/res/index.bs.js"></script>
- When you open http://localhost:8080,
http://localhost:8080/res/index.bs.js
is loaded correctly but it couldn't load/res/index.css.proxy.js
:
- Because the dependency we are depending on still remains in
src/
while the generated js has been moved tolib/es6/src
:
// src/App.res
%%raw(`import './App.css';`)
I don't have a solution or workaround for this at the moment, this might be worthwhile to raise this issue in snowpack.