@anejs/mina-loader

0.6.4 • Public • Published

mina-loader

fork mina-loader 换 wxml-loader 为修改后的 @anejs/wxml-loader MINA single-file-component loader for Webpack.

npm npm license PRs Welcome

Inspired by zezhipeng/mina-loader.

Installation

npm i --save-dev @tinajs/mina-loader

Usage

/**
 * webpack.config.js
 */
module.exports = {
  context: resolve('src'),
  entry: {
    'app.mina': './app.mina',
    'pages/home.mina': './pages/home.mina',
  },
  output: {
    path: resolve('dist'),
    filename: '[name]',
    publicPath: '/',
  },
  module: {
    rules: [
      {
        test: /\.mina$/,
        use: {
          loader: 'mina-loader',
          /**
           * see Options
           */
          options: {
            loaders: {
              script: 'babel-loader',
              style: {
                loader: 'postcss-loader',
                options: {
                  config: {
                    path: resolve('./postcss.config.js'),
                  },
                },
              },
            },
          },
        },
      },
    ],
  },
}

For the best particle, you might also be interested in mina-webpack.

Options

Name Default Description
loaders {} A map of Rules.use. See Webpack - Module - Rule.use for details.
loaders.config undefined The Rules.use for <config>.
loaders.template undefined The Rules.use for <template>
loaders.script undefined The Rules.use for <script>
loaders.style undefined The Rules.use for <style>
publicPath output.publicPath Useful for relative publicPath, see extract-loader - options

Example

License

Apache-2.0 © yelo, 2017 - present

Readme

Keywords

none

Package Sidebar

Install

npm i @anejs/mina-loader

Weekly Downloads

2

Version

0.6.4

License

Apache-2.0

Unpacked Size

26.2 kB

Total Files

9

Last publish

Collaborators

  • rrc-fe
  • xierenhong