@misk/common
@misk/common
provides shared libraries, externals, and styles between @misk
modules.
Getting Started
$ yarn add @misk/common
-
Using the common vendors libraries and styles. We use copy-webpack-plugin
to copy the compiled vendor.js
file into build folder.
-
Install copy-webpack-plugin
npm i -D copy-webpack-plugin
-
Add the following to your webpack.config.js
const CopyWebpackPlugin = require('copy-webpack-plugin');
...
module.exports = {
mode
entry
...
plugins: [
new CopyWebpackPlugin(
[{ from: './node_modules/@misk/common/lib' }],
{ debug: 'info', copyUnmodified: true }
)
],
}
-
Add the following to your index.html
to import styles.js
and vendors.js
<body>
...
<script type="text/javascript" src="js/styles.js" async></script>
<script type="text/javascript" src="js/vendors.js" preload></script>
</body>
-
Use @misk/common
externals to keep Webpack from bundling duplicate libraries and styles into your Misk module. Add the following to your webpack.config.js
const miskCommon = require('@misk/common');
...
module.exports = {
mode
entry
...
externals: miskCommon.externals,
}
Included Libraries
- Check in
src/externals.ts
Included Styles
import './styles/misk-common.css'
import '../node_modules/@blueprintjs/core/lib/css/blueprint.css'
import '../node_modules/normalize.css/normalize.css'
import '../node_modules/skeleton-css/css/skeleton.css'
Authors