vue-webpack-typescript icon indicating copy to clipboard operation
vue-webpack-typescript copied to clipboard

Unable to exclude certain paths from webpack build

Open simon-lang opened this issue 6 years ago • 0 comments

Create a fresh install of this boilerplate:

vue init ducksoupdev/vue-webpack-typescript example
cd example
npm install

Add the following to a file outside the src directory, for example server/server.ts

const wrong: notatype = 'test'

Note the invalid typescript syntax.

Now try npm run dev

You will see the error:

ERROR in [at-loader] ./server/server.ts:1:14
    TS2304: Cannot find name 'notatype'.
Child html-webpack-plugin for "index.html":
     1 asset
    [./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html 425 bytes {0} [built]
webpack: Failed to compile.

In the webpack.config.base.js, I try to exclude this folder. e.g.

    {
      test: /\.ts$/,
      exclude: /node_modules/,
      enforce: 'pre',
      loader: 'tslint-loader',
      exclude: ['./server']
    },
    {
      test: /\.ts$/,
      exclude: /node_modules/,
      loader: 'awesome-typescript-loader',
      exclude: ['./server']
    },

But it still appears to be bundling it.

Am I missing something?

simon-lang avatar May 02 '18 06:05 simon-lang