@tinajs/mina-runtime-webpack-plugin
v1.3.7
Published
A runtime patch for compiling mina project by Webpack
Downloads
85
Readme
mina-runtime-webpack-plugin
A runtime patch for compiling mina project by Webpack.
Heavily inspired by and forked from Cap32/wxapp-webpack-plugin.
Installation
npm i --save-dev @tinajs/mina-runtime-webpack-plugin
Usage
/**
* webpack.config.js
*/
const webpack = require('webpack')
const MinaRuntimePlugin = require('@tinajs/mina-runtime-webpack-plugin')
const resolve = require('path').resolve
module.exports = {
context: resolve('src'),
entry: {
'app.mina': './app.mina',
'pages/home.mina': './pages/home.mina',
},
output: {
path: resolve('dist'),
filename: '[name]',
publicPath: '/',
globalObject: 'wx',
},
module: {
rules: [
{
test: /\.mina$/,
use: {
loader: '@tinajs/mina-loader',
},
},
],
},
plugins: [new MinaRuntimePlugin()],
optimization: {
splitChunks: {
chunks: 'all',
name: 'common.js',
minChunks: 2,
minSize: 0,
},
runtimeChunk: {
name: 'runtime.js',
},
},
mode: 'none',
}
For the best particle, you might also be interested in mina-webpack.
Example
License
MIT © yelo, 2017 - present