1.10.0 • Published 3 years ago

@tinajs/mina-loader v1.10.0

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

mina-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 webpack@^4.0.0

Note you'll have to use webpack 4.

Usage

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

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

Options

NameDefaultDescription
loaders{ config: '', template: '', script: '', style: '' }A map of Rules.use. See Webpack - Module - Rule.use for details.
loaders.config''The Rules.use for <config>.
loaders.template''The Rules.use for <template>
loaders.script''The Rules.use for <script>
loaders.style''The Rules.use for <style>
languages{}Used in the .mina file with the lang attribute. A map of Rules.use. See Webpack - Module - Rule.use for details.
extensions{ config: '.json', template: '.wxml', style: '.wxss' }The extension names of the emitted files
extensions.config'.json'The extension name of the file emitted with the <config> block
extensions.template'.wxml'The extension name of the file emitted with the <template> block
extensions.style'.wxss'The extension name of the file emitted with the <style> block
transform(ast) => astFunction used to transform mina AST before emitting files. Useful for translate mina into another language, such as Alipay Mini Programs or pure web pages
publicPathoutput.publicPathUseful for relative publicPath, see extract-loader - options
enforceRelativePathtrueThe same option enforceRelativePath in wxml-loader, see wxml-loader - Usage. It is highly recommended to keep the default.

Example

License

Apache-2.0 © yelo, 2017 - present

1.10.0

3 years ago

1.9.3

4 years ago

1.9.2

4 years ago

1.9.1

4 years ago

1.9.0

4 years ago

1.8.3

4 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.2

5 years ago

1.7.1

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

1.0.0-10

6 years ago

1.0.0-9

6 years ago

1.0.0-8

6 years ago

1.0.0-7

6 years ago

1.0.0-6

6 years ago

1.0.0-4

6 years ago

1.0.0-3

6 years ago

1.0.0-2

6 years ago

1.0.0-1

6 years ago

1.0.0-0

6 years ago

0.7.0

6 years ago

0.6.6

6 years ago

0.6.5

6 years ago

0.6.4

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago