Skip to content

Commit

Permalink
Merge pull request #4125 from brave/styled-components-devtools
Browse files Browse the repository at this point in the history
Friendly class names for styled-components Elements in non-official builds
  • Loading branch information
cezaraugusto authored Dec 18, 2019
2 parents f689c49 + 643e564 commit 7e9a300
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
8 changes: 8 additions & 0 deletions components/webpack/webpack-ts-transformers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const TypescriptPluginStyledComponents = require('typescript-plugin-styled-components')
const createStyledComponentsTransformer = TypescriptPluginStyledComponents.default
const styledComponentsTransformer = createStyledComponentsTransformer()
module.exports = () => ({
before: [
styledComponentsTransformer
]
})
13 changes: 12 additions & 1 deletion components/webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
// Copyright (c) 2019 The Brave Authors. All rights reserved.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// you can obtain one at http://mozilla.org/MPL/2.0/.

const path = require('path')
const GenerateDepfilePlugin = require('./webpack-plugin-depfile')
const createStyledComponentsTransformer = require('typescript-plugin-styled-components').default

const styledComponentsTransformer = createStyledComponentsTransformer()

module.exports = (env, argv) => ({
devtool: argv.mode === 'development' ? '#inline-source-map' : false,
Expand Down Expand Up @@ -27,7 +35,10 @@ module.exports = (env, argv) => ({
rules: [
{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader'
loader: 'awesome-typescript-loader',
options: {
getCustomTransformers: path.join(__dirname, './webpack-ts-transformers.js')
}
},
{
test: /\.css$/,
Expand Down

0 comments on commit 7e9a300

Please sign in to comment.