---
title: "Webpack: Bundle Unimported Assets"
description: "How to bundle files not imported in source using webpack. Practical notes and code examples on Webpack: Bundle Unimported."
url: "https://h3manth.com/scribe/webpack-bundle-unimported-assets/"
canonical_url: "https://h3manth.com/scribe/webpack-bundle-unimported-assets/"
markdown_url: "https://h3manth.com/scribe/blog/webpack-bundle-unimported-assets.md"
publishDate: "2016-07-23T00:00:00.000Z"
author: "Hemanth HM"
category: "web"
tags: ["webpack","javascript"]
word_count: 62
reading_time_minutes: 1
x_markdown_tokens: 303
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Webpack: Bundle Unimported Assets

> How to bundle files not imported in source using webpack. Practical notes and code examples on Webpack: Bundle Unimported.

Bundle files that aren't `require`d or `import`ed:

```javascript
const ExtractSass = {
  entry: glob_entries('./public/styles/external/*.less'),
  output: {
    filename: './.build/junk/[name].[chunkhash].js',
  },
  module: {
    loaders: [{
      test: /\.less$/,
      loader: ExtractTextPlugin.extract(
        'isomorphic-style-loader',
        'css-loader?modules&localIdentName=[name]_[local]',
        'less-loader'
      )
    }]
  },
  plugins: [
    new ExtractTextPlugin('./.build/css/[name].css')
  ]
};
```

## Dependencies

- [extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin)
- [webpack-glob-entries](https://www.npmjs.com/package/webpack-glob-entries)
- [isomorphic-style-loader](https://github.com/kriasoft/isomorphic-style-loader)

The trick: create JS files for each LESS file, then extract them to CSS.
