# mina-webpack
**Repository Path**: tinajs/mina-webpack
## Basic Information
- **Project Name**: mina-webpack
- **Description**: Mina single-file-component meets Webpack
- **Primary Language**: JavaScript
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2018-03-12
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
mina-webpack
Mina single-file-component meets Webpack

[](http://makeapullrequest.com)
## Get Started
We recommend you to get started with [template-mina](https://github.com/tinajs/template-mina):
```bash
npm i -g sao
sao mina my-app
cd my-app
npm start
```
And see how to use with [TinaJS](https://tinajs.github.io/tina/#/guide/package-management-and-build-tools)
## Packages included
- [mina-loader](./packages/mina-loader)
[](https://www.npmjs.com/package/@tinajs/mina-loader)
[](https://www.npmjs.com/package/@tinajs/mina-loader)
[](./LICENSE)
- [mina-runtime-webpack-plugin](./packages/mina-runtime-webpack-plugin)
[](https://www.npmjs.com/package/@tinajs/mina-runtime-webpack-plugin)
[](https://www.npmjs.com/package/@tinajs/mina-runtime-webpack-plugin)
[](./LICENSE)
- [mina-entry-webpack-plugin](./packages/mina-entry-webpack-plugin)
[](https://www.npmjs.com/package/@tinajs/mina-entry-webpack-plugin)
[](https://www.npmjs.com/package/@tinajs/mina-entry-webpack-plugin)
[](./LICENSE)
## Manual Installation
```bash
npm i --save-dev \
@tinajs/mina-entry-webpack-plugin \
@tinajs/mina-runtime-webpack-plugin \
@tinajs/mina-loader
```
## Simplest Usage
**webpack.config.js**:
```javascript
const webpack = require('webpack')
const MinaEntryPlugin = require('@tinajs/mina-entry-webpack-plugin')
const MinaRuntimePlugin = require('@tinajs/mina-runtime-webpack-plugin')
const resolve = require('path').resolve
module.exports = {
context: resolve('src'),
entry: './app.mina',
output: {
path: resolve('dist'),
filename: '[name]',
publicPath: '/',
},
module: {
rules: [
{
test: /\.mina$/,
use: {
loader: 'mina-loader',
options: {
loaders: {
script: 'babel-loader',
},
},
},
},
],
},
plugins: [
new MinaEntryPlugin({
map: (entry) => ['es6-promise/dist/es6-promise.auto.js', entry],
}),
new MinaRuntimePlugin({
runtime: './common.js',
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'common.js',
minChunks: 2,
}),
],
}
```
**app.mina**:
```html
{
"pages": [
"page.mina"
]
}
```
**page.mina**:
```html
{
"window":{
"navigationBarTitleText": "Hello, World!"
}
}
{{ msg }}
```
## Examples
- [mina-webpack - Full Example](./example)
- [mina-loader - test](./packages/mina-loader/test)
- [TinaJS - HackerNews Reader](https://github.com/tinajs/tina-hackernews)
## Related Projects
### Best to use with
- [TinaJS](https://github.com/tinajs/tina)
### Scaffolds
- [template-mina](https://github.com/tinajs/template-mina)
- [ambar/new-mina](https://github.com/ambar/new-mina)
### Other package compiler (also alternatives)
- [gulp-mina](https://github.com/tinajs/gulp-mina)
### Got inspiration from
- [Cap32/wxapp-webpack-plugin](https://github.com/Cap32/wxapp-webpack-plugin)
- [CantonJS/wxapp-boilerplate](https://github.com/cantonjs/wxapp-boilerplate)
- [zezhipeng/mina-loader](https://github.com/zezhipeng/mina-loader)
- [Vue - Single File Component](https://vuejs.org/v2/guide/single-file-components.html)
[](https://github.com/tinajs/tina)