Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@tinajs/mina-loader

Package Overview
Dependencies
Maintainers
3
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinajs/mina-loader

MINA single-file-component loader for Webpack

latest
Source
npmnpm
Version
1.10.0
Version published
Weekly downloads
86
-3.37%
Maintainers
3
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 07 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts