awesome-typescript-loader icon indicating copy to clipboard operation
awesome-typescript-loader copied to clipboard

useBabel is not work!!!!

Open printjs opened this issue 7 years ago • 4 comments

webpack

{
    test: /\.(ts|tsx)$/,
    loader: 'awesome-typescript-loader',
    options: {
          transpileOnly:true,
          useBabel:true
     },
},

.babelrc

{
    "presets": [
        ["env", {
            "targets": "last 2 versions, ie 11",
            "modules": false
        }]
    ],
    "plugins": [
        ["import", {
            "libraryName": "antd",
            "style": "css"
        }]
    ]
}

I do not import antd styles.Due to the babel-plugin-import is not work.

printjs avatar Nov 06 '17 03:11 printjs

@s-panferov

printjs avatar Nov 06 '17 05:11 printjs

who can help me?

printjs avatar Nov 08 '17 14:11 printjs

Try passing useBabel as 'awesome-typescript-loader?useBabel=true&useCache=true'. You can see it in this small snippets:

const entry = [
  'react-hot-loader/patch',
  'webpack-dev-server/client?http://localhost:8080',
  'webpack/hot/only-dev-server',
  './src/index.tsx',
]

const output = {
  filename : 'bundle.js',
  path     : __dirname + '/dev_dist',
}

const tsxLoader = [
  'react-hot-loader/webpack',
  'awesome-typescript-loader?useBabel=true&useCache=true',
]

const typescriptRule = {
  test    : /\.tsx?$/,
  loader  : tsxLoader,
  include : [ `${ __dirname }/src` ],
  exclude : [ /node_modules\/(?!(notify)\/).*/ ],
}

const rules = [
  typescriptRule,
  sourceMapRule,
  cssRule,
  lessRule,
]

module.exports = {
  entry   : entry,
  output  : output,
  plugins : plugins,
  resolve : { extensions : [ '.ts', '.tsx', '.js' ] },
  module  : { rules : rules },
}

The configuration is from https://github.com/selfrefactor/rx-starter

selfrefactor avatar Jan 05 '18 14:01 selfrefactor

+1

indiejoseph avatar Sep 15 '18 17:09 indiejoseph