def _build(self, notebook: Optional[str] = None) -> None:
        """Compile the Bowtie application."""
        if node_version() < _MIN_NODE_VERSION:
            raise WebpackError(
                f'Webpack requires at least version {_MIN_NODE_VERSION} of Node, '
                f'found version {node_version}.'
            )

        packages = self._write_templates()

        for filename in ['package.json', 'webpack.prod.js', 'webpack.dev.js']:
            if not (self._build_dir / filename).is_file():
                sourcefile = self._package_dir / 'src' / filename
                shutil.copy(sourcefile, self._build_dir)

        if self._run(['yarn', '--ignore-engines', 'install'], notebook=notebook) > 1:
            raise YarnError('Error installing node packages')

        if packages:
            installed = self._installed_packages()
            new_packages = [x for x in packages if x.split('@')[0] not in installed]

            if new_packages:
                retval = self._run(
                    ['yarn', '--ignore-engines', 'add'] + new_packages, notebook=notebook
                )
                if retval > 1:
                    raise YarnError('Error installing node packages')
                elif retval == 1:
                    print('Yarn error but trying to continue build')
        retval = self._run([_WEBPACK, '--config', 'webpack.dev.js'], notebook=notebook)
        if retval != 0:
            raise WebpackError('Error building with webpack')
Compile the Bowtie application.