-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POC build using snowpack #400
Comments
Overall, I don't think this will go as planned as the Ignoring that, I tried a few different things to get a snowpack build going. Maybe someone else will have better luck.
Using the defaultssnowpack seems to have sensible defaults, and I saw people using it with no configuration with good results. In this case, I couldn't get pass the install stage. It seems like it's not resolving modules properly.
I tried a couple of different options with @rollup/plugin-node-resolve and @rollup/plugin-commonjs but couldn't get anything interesting to happen.
module.exports = {
"installOptions": {
"rollup": {
"plugins": [
require('@rollup/plugin-node-resolve').default(),
require('@rollup/plugin-commonjs')()
]
}
}
}; Using app-scripts-reactThis is the package that's installed when using create-snowpack-app and using the react typescript template. Since they are basically the same, I figured a few modifications to the configuration files in app-scripts-react might give us something close. I ran into a couple of issues.
Using a custom typescript pluginBy default, snowpack runs TypeScript code through babel, using @babel/preset-typescript for transformation. Unfortunately, since this doesn't actually use typescript, options in tsconfig are not honored. I tried writing a custom plugin to process TypeScript files.
const ts = require('typescript');
const tsconfig = require('./tsconfig.json');
module.exports = function createPlugin(snowpackConfig, pluginOptions) {
return {
"defaultBuildScript": "build:mjs,js,jsx,ts,tsx",
async build({ contents, filePath, fileContents }) {
if(!filePath.endsWith('.ts') && !filePath.endsWith('.tsx')) {
return;
}
const result = ts.transpileModule(contents || fileContents , { compilerOptions: tsconfig.compilerOptions });
return { result: result.outputText };
}
};
}; This runs tsx/ts files through Typescript before they get to snowpack, using the tsconfig from the package root. This resulted in properly generated javascript files using
{
"plugins": [
"./ts"
]
} This caused similar problems with commonjs and not using mjs files as the |
So the
With this config (and and index.html file in public that points to the appropriate main.js and main.css files) the app started up successfully. However, theming is not working and no classes are being applied to nodes. |
So the last issues with theming were remedied by changing |
Investigate if its possible to build a dojo app using snowpack.
The text was updated successfully, but these errors were encountered: