0.6.4 • Published 7 years ago

@anejs/mina-loader v0.6.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 years ago

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

NameDefaultDescription
loaders{}A map of Rules.use. See Webpack - Module - Rule.use for details.
loaders.configundefinedThe Rules.use for <config>.
loaders.templateundefinedThe Rules.use for <template>
loaders.scriptundefinedThe Rules.use for <script>
loaders.styleundefinedThe Rules.use for <style>
publicPathoutput.publicPathUseful for relative publicPath, see extract-loader - options

Example

License

Apache-2.0 © yelo, 2017 - present