1.1.3 • Published 4 years ago

@baaz/buildpack v1.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

@baaz/buildpack npm version

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'] };