@baaz/buildpack
v1.1.3
Published
Build/Layout optimization tooling and framework adapters for the PWA
Downloads
16
Maintainers
Readme
@baaz/buildpack
React + @baaz/buildpack + @baaz/buildpack
1. Getting Started
- You need to create a webpack.config.js.
// ...
const {
configureWebpack
} = require('@baaz/buildpack');
const HtmlWebPackPlugin = require("html-webpack-plugin");
const { DefinePlugin } = require('webpack');
module.exports = async (env, argv = {}) => {
const { clientConfig, serviceWorkerConfig } = await configureWebpack({
context: __dirname,
vendor: [
// 'react',
// 'react-dom',
],
special: {
// 'buikit': {
// cssModules: true,
// esModules: true,
// },
// '@baaz/adapter': {
// esModules: true,
// cssModules: true
// }
},
env,
argv
});
clientConfig.plugins = [
...clientConfig.plugins,
new DefinePlugin({
/**
* Make sure to add the same constants to
* the globals object in jest.config.js.
*/
PWA_NAME: JSON.stringify('BAAZ PWA')
}),
new HtmlWebPackPlugin({
template: "./template.html",
filename: "./index.html"
})
];
return [clientConfig, serviceWorkerConfig];
};
//...
2. babel.config.js
create a babel.config.js
module.exports = { presets: ['@baaz/adapter'] };