npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pluswerk/webpack-config

v1.5.0

Published

**install** ````bash yarn add @pluswerk/webpack-config --dev ```` **package.json** ````json { "scripts": { "build": "webpack --mode production --config node_modules/@pluswerk/webpack-config/webpack.config.js --hide-modules", "build:watch": "webpack --watc

Downloads

77

Readme

Configs:

install

yarn add @pluswerk/webpack-config --dev

package.json

{
  "scripts": {
    "build": "webpack --mode production --config node_modules/@pluswerk/webpack-config/webpack.config.js --hide-modules",
    "build:watch": "webpack --watch --mode production --config node_modules/@pluswerk/webpack-config/webpack.config.js --hide-modules",
    "build:dev": "webpack --mode development --config node_modules/@pluswerk/webpack-config/webpack.config.js --hide-modules",
    "build:dev:watch": "webpack --watch --mode development --config node_modules/@pluswerk/webpack-config/webpack.config.js --hide-modules",
    "serve": "webpack-dev-server --config node_modules/@pluswerk/webpack-config/webpack.hmr.config.js --mode development --colors --progress --inline --hide-modules"
  },
  "browserslist": [
    "last 2 versions",
    "IE 11"
  ],
  "sideEffects": true
}

build.settings.js

module.exports = {
  directory: {
    typescript: 'Typescript/',
    scss: 'Scss/',
    generated: 'Generated/',
    publicPath: 'Generated/',
  },
  entry: {
    main: ['./Typescript/index.ts', './Scss/index.scss']
  }
};

Web Root != Project Root

if your Project locks like this:

build.settings.js
Typescript/...
Scss/...
public/index.html
public/Generated/...

You must set the publicPath in your settings:

build.settings.js

module.exports = {
  directory: {
    typescript: 'Typescript/',
    scss: 'Scss/',
    generated: 'public/Generated/', //as seen from your build.settings.js
    publicPath: 'Generated/', //as seen from the Browser
  },
  entry: {
    main: ['./Typescript/index.ts', './Scss/index.scss']
  }
};

Overwrite configs:

you can overwrite tsconfig.json, tslint.json and stylelint.config.js.

  • Either name the file exactly the same and put it in the root directory.
  • Or you can adjust the path in build.settings.js and put the file wherever you like.

These files should extend the defaults of the package. See:

example tsconfig.json

{
  "extends": "./node_modules/@pluswerk/webpack-config/tsconfig",
  "files": [
    "pathToYourTsFiles/index.ts",
    "pathToYourTsFiles/types.d.ts",
    "pathToYourTsFiles/vue-shims.d.ts",
  ],
  "include": [
    "pathToYourTsFiles/**/*.ts",
    "pathToYourTsFiles/**/*.vue"
  ],
  "exclude": [
    "node_modules/"
  ],
  "types": [
    "node"
  ]
}

example to overwrite tslint.json

{
  "extends": "./node_modules/@pluswerk/webpack-config/tslint.json"
}

example to overwrite stylelint.config.js

module.exports = {
  extends: './node_modules/@pluswerk/webpack-config/stylelint.config.js'
}

Options of build.settings.js:

module.exports = {
  directory: {
    typescript: 'Typescript/',
    scss: 'Scss/',
    generated: 'Generated/',
    publicPath: null, // same as 'directory.generated' by default
  },
  files: {
    tsConfig: './tsconfig.json',
    tsLint: './tslint.json',
    stylelint: './stylelint.config.js',
  },
  entry: {
    main: ['./Typescript/index.ts', './Scss/index.scss']
  },
  envPath: '.env',
  serverActiveEnv: 'NODE_ACTIVE=TRUE',
  serverInactiveEnv: 'NODE_ACTIVE=FALSE',
  // more info on definePlugin: https://webpack.js.org/plugins/define-plugin/
  definePlugin: {
    BOOLEAN_ENV: !!process.env.BOOLEAN_ENV,
    STRING_ENV: JSON.stringify(process.env.STRING_ENV),
  },
  webpackConfig: {},
}

!!! TIP: you can overwrite all the webpackConfig parameters within build.settings.js

Example .vue file

Component.vue

<!-- currently it is not possible to use inline Typescript files. -->
<script lang="ts" src="./Component.ts"></script>

<template>
  <div class="background--red">
    Green
  </div>
</template>

<!-- to bundle vue's css into js and not bundle "normal" css, it is required to set the lang to vue-scss -->
<style lang="vue-scss" type="text/scss" scoped>
  .background--red { 
    background: red;
  }
</style>

Component.ts

import Vue from 'vue';
import Component from 'vue-class-component';

@Component({
  props: {
    value: Array,
  },
})
export default class FilterMultiSelect extends Vue {
  get internalValue() {
    return this.$props.value.filter(el => !!el);
  }
}

TODO:

  • dosn't lint scss inside vue
  • sideEffects:true https://github.com/vuejs/vuepress/issues/718